opentitan icon indicating copy to clipboard operation
opentitan copied to clipboard

[tlul regtool] multireg does not work for regs with more than 1 bit definition

Open mwbranstad opened this issue 6 years ago • 10 comments

csrng_fail_elab.zip

The attached file shows an example where more than 1 bit is in a multireg register. The regtool processes this ok, but the linter fails in the elab step. Removing the bits, and leaving just one bit allows the compile to pass.

Is this a feature or a bug?

mwbranstad avatar Apr 01 '20 18:04 mwbranstad

@eunchan

sjgitty avatar Apr 01 '20 19:04 sjgitty

Looks like this is a bug. After multireg bitarray feature is implemented, it creates mreg structure incorrectly. for instance,

  typedef struct packed {
    struct packed {
      logic        q;
    } ins_req;
    struct packed {
      logic        q;
    } app_seed_clr;
    struct packed {
      logic        q;
    } det_mode;
    struct packed {
      logic        q;
    } ins_req;
    struct packed {
      logic        q;
    } app_seed_clr;
    struct packed {
      logic        q;
    } det_mode;
    struct packed {
      logic        q;
    } ins_req;
    struct packed {
      logic        q;
    } app_seed_clr;
    struct packed {
      logic        q;
    } det_mode;
    struct packed {
      logic        q;
    } ins_req;
    struct packed {
      logic        q;
    } app_seed_clr;
    struct packed {
      logic        q;
    } det_mode;
  } csrng_reg2hw_cs_app_ins_req_mreg_t;

The structure csrng_reg2hw_cs_app_ins_req_mreg_t has multiple internal structures that have same name ins_req.

eunchan avatar Apr 01 '20 20:04 eunchan

@mwbranstad we did a quick hack, do you mind trying again with the latest? Hopefully it should work better now.

tjaychen avatar Apr 02 '20 23:04 tjaychen

I updated git from the upstream master, and did not see an update to regtool.py. What is the process to try out this hack?

mwbranstad avatar Apr 03 '20 14:04 mwbranstad

@tjaychen See prior comment.

mwbranstad avatar Apr 03 '20 14:04 mwbranstad

@tjaychen @eunchan FYI - I have worked around this problem in my current hjson file. The attached file is all that I would run to verify any fix, so if that works for you, then i am guessing it is fixed. It is possible i may go back and rework part of the hjson file, but that would be after bronze.

mwbranstad avatar Apr 03 '20 14:04 mwbranstad

The file that was updated is util/reggen/validate.py

So as long as you have the latest version, you should be able to just run the reg make and things will hopefully be okay.

On Fri, Apr 3, 2020, 07:56 mwbranstad [email protected] wrote:

@tjaychen https://github.com/tjaychen @eunchan https://github.com/eunchan FYI - I have worked around this problem in my current hjson file. The attached file is all that I would run to verify any fix, so if that works for you, then i am guessing it is fixed. It is possible i may go back and rework part of the hjson file, but that would be after bronze.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lowRISC/opentitan/issues/1872#issuecomment-608488993, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH2RSVB45C37SRVBI3LY5LRKX2LRANCNFSM4LZMFUTQ .

tjaychen avatar Apr 03 '20 15:04 tjaychen

@mwbranstad does this work for you now? If yes, can you close this issue?

msfschaffner avatar Apr 18 '20 00:04 msfschaffner

@msfschaffner I worked around this issue, so yes it works for me because of that. I was unable to run a pre-worked around version successfully, but then I run the regtool outside of the OT flow. We can either close this or assign to whom ever made the fix and confirmed it.

mwbranstad avatar Apr 20 '20 13:04 mwbranstad

Based on new usage, not seeing this issue anymore.

mwbranstad avatar Jul 28 '20 15:07 mwbranstad