opentitan icon indicating copy to clipboard operation
opentitan copied to clipboard

Request for seed input to prim_lfsr

Open mwbranstad opened this issue 7 years ago • 9 comments

The recommendation is to reuse the prim_lfsr versus a custom version. To do this, a feature to load the seed into the shift register is needed, rather than using the parameter.

mwbranstad avatar Nov 07 '19 14:11 mwbranstad

Another feature to consider is to have a programmable polynomial, whereby a mask is used to gate the proper feedback paths to each stage of the shift register. This puts the burden of the polynomial solely on the firmware.

mwbranstad avatar Nov 07 '19 19:11 mwbranstad

Hi @mwbranstad,

Yes I saw the issue, just didn't get a chance to write back yet.

Do we have use cases for external seed / polynomial inputs? If so, could you provide some more info?

We should keep in mind that a general implementation with loadable polynomial/seed 1) requires more logic and 2) is not desirable for certain security critical applications (although in those cases we could probably just tie these ports constantly off).

msfschaffner avatar Nov 08 '19 20:11 msfschaffner

The loadable polynomial feature is not one that I need, but was suggested by a WD co-worker. If you choose to not implement such a function, that is fine with me.

I do need a seed loading function, however. If this function is added to the prim_lfsr block, then I will use this block.

From: Michael Schaffner [email protected] Sent: Friday, November 8, 2019 2:01 PM To: lowRISC/opentitan [email protected] Cc: Mark Branstad [email protected]; Mention [email protected] Subject: Re: [lowRISC/opentitan] Request for seed input to prim_lfsr (#913)

Hi @mwbranstadhttps://github.com/mwbranstad,

Yes I saw the issue, just didn't get a chance to write back yet.

Do we have use cases for external seed / polynomial inputs? If so, could you provide some more info?

We should keep in mind that a general implementation with loadable polynomial/seed 1) requires more logic and 2) is not desirable for certain security critical applications (although in those cases we could probably just tie these ports constantly off).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/lowRISC/opentitan/issues/913?email_source=notifications&email_token=AMTDD3IPIF7OPJAKTLB6B7DQSXAODA5CNFSM4JKHPVG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDTGKTA#issuecomment-551970124, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMTDD3MSBORAQJ7WHD7TPHTQSXAODANCNFSM4JKHPVGQ.

mwbranstad avatar Nov 08 '19 20:11 mwbranstad

Ok, are you thinking about something like this?

(
  input                     clk_i,
  input                     rst_ni,
  input                     en_i,
  input                     seed_en_i,
  input        [LfsrDw-1:0] seed_i,
  input        [InDw-1:0]   data_i,
  output logic [OutDw-1:0]  data_o
);

I think that should be ok. Concerning the polynomial coefficient input I am not so sure whether that would be a feature that we really need. @sjgitty @tjaychen WDYT?

msfschaffner avatar Nov 08 '19 21:11 msfschaffner

Yes, a load signal, and a seed value that is the width of the LFSR. I believe the load should take priority of all other operations for the SR (feedback mux priority).

From: Michael Schaffner [email protected] Sent: Friday, November 8, 2019 3:34 PM To: lowRISC/opentitan [email protected] Cc: Mark Branstad [email protected]; Mention [email protected] Subject: Re: [lowRISC/opentitan] Request for seed input to prim_lfsr (#913)

Ok, are you thinking about something like this?

(

input clk_i,

input rst_ni,

input en_i,

input seed_en_i,

input [LfsrDw-1:0] seed_i,

input [InDw-1:0] data_i,

output logic [OutDw-1:0] data_o

);

I think that should be ok. Concerning the polynomial coefficient input I am not so sure whether that would be a feature that we really need. @sjgittyhttps://github.com/sjgitty @tjaychenhttps://github.com/tjaychen WDYT?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/lowRISC/opentitan/issues/913?email_source=notifications&email_token=AMTDD3ONOXXRNUYBWRQRHBDQSXLLFA5CNFSM4JKHPVG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDTNB5Q#issuecomment-551997686, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMTDD3MN5DN65ETREGGD2QTQSXLLFANCNFSM4JKHPVGQ.

mwbranstad avatar Nov 08 '19 23:11 mwbranstad

I think adding the seed enable and input is a useful thing, and if seed_en is tied to 0 it probably wouldn't cost extra. For the polynomial, you already have the parameter, I think that should probably suffice for most use cases, no?

sjgitty avatar Nov 10 '19 16:11 sjgitty

Yeah I agree with Scott. A seed load seems like a nice option.

On Sun, Nov 10, 2019, 08:47 Scott Johnson [email protected] wrote:

I think adding the seed enable and input is a useful thing, and if seed_en is tied to 0 it probably wouldn't cost extra. For the polynomial, you already have the parameter, I think that should probably suffice for most use cases, no?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lowRISC/opentitan/issues/913?email_source=notifications&email_token=AAH2RSTCQCKGAXKP6GQ4S6TQTA3JLA5CNFSM4JKHPVG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDVBLOI#issuecomment-552211897, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH2RSSEUSW7YMEBBZ2HMBLQTA3JLANCNFSM4JKHPVGQ .

tjaychen avatar Nov 10 '19 18:11 tjaychen

@mwbranstad can we close this one?

msfschaffner avatar Nov 26 '19 23:11 msfschaffner

I have verified that the new io exist on the module prim_lfsr.sv in the repo. If there are any functional issues resulting from this change, a new issue will be created.

mwbranstad avatar Dec 02 '19 17:12 mwbranstad