rggen / rggen

Code generation tool for control and status registers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vivado Doesn't like this systemverilog code

megeed opened this issue · comments

`ifndef rggen_connect_bit_field_if
  `define rggen_connect_bit_field_if(RIF, FIF, LSB, WIDTH) \
  assign  FIF.valid                 = RIF.valid; \
  assign  FIF.read_mask             = RIF.read_mask[LSB+:WIDTH]; \
  assign  FIF.write_mask            = RIF.write_mask[LSB+:WIDTH]; \
  assign  FIF.write_data            = RIF.write_data[LSB+:WIDTH]; \
  assign  RIF.read_data[LSB+:WIDTH] = FIF.read_data; \
  assign  RIF.value[LSB+:WIDTH]     = FIF.value;
`endif


`ifndef rggen_tie_off_unused_signals
  `define rggen_tie_off_unused_signals(WIDTH, VALID_BITS, RIF) \
  if (1) begin : __g_tie_off \
    genvar  __i; \
    for (__i = 0;__i < WIDTH;++__i) begin : g \
      if ((((VALID_BITS) >> __i) % 2) == 0) begin : g \
        assign  RIF.read_data[__i]  = 1'b0; \
        assign  RIF.value[__i]      = 1'b0; \
      end \
    end \
  end
`endif

First one I got rid of the \ and made it one line. It was happy. The second one I couldn't get it to work.

Vivado can synthesis generated SV RTL so I don't understand what is wrong.
Can you put your synthesis log?

I'm using generated SV RTL with Vivado and no errors are reported.
So I think Vivado you are using is too old.

I think we can close the issue. This is definitely not a rggen issue.

closing

I think you defined such big register to pack bit fields related to a functionality.
If yes, you can divide this register into multiple small registers and group them by using the register_file layer.
https://github.com/rggen/rggen-sample/blob/ebed8c251d31a3bed4e148168aa6b6e25283d74a/block_1.yml#L8