pymtl / pymtl3

Pymtl 3 (Mamba), an open-source Python-based hardware generation, simulation, and verification framework
BSD 3-Clause "New" or "Revised" License
388 stars 46 forks source link

No error or warning thrown when using `<<=` in a update block #139

Closed yo96 closed 11 months ago

yo96 commented 4 years ago

I just used @s.update instead of @s.update_ff for a sequential block and pymtl3 didn't complain. When trying to translate it Verilator gives me this error:

E     Verilator output:
E     %Warning-COMBDLY: SwitchUnitMFlitRTL__a78c05a9be637c7c.sv:558: Delayed assignments (<=) in non-clocked (non flop or latch) block
E                                                                  : ... Suggest blocking assignments (=)

We should probably check this during elaboration? I think we check @s.update_ff but seems not @s.update

jsn1993 commented 4 years ago

it would require some deep hacking on the parsing process ... because it is possible for a CL model to use <<= in calculation.

yo96 commented 4 years ago

hmm if we have update once would that make this easier?

ptpan commented 11 months ago

I can confirm PyMTL now throws the following error when using <<= instead an @update block:

E   pymtl3.dsl.errors.UpdateBlockWriteError:
E   In file /work/global/pp482/clean/pymtl3/pymtl3/stdlib/mem/ROM.py:47 in up_read_rom
E
E   47         s.rdata[i] <<= s.mem[ s.raddr[i] ]
E
E   ^^^ In update, only '@=' statements can assign value to signals, not <<=
E   (when constructing instance s of class "SequentialROM" in the hierarchy)
E
E   Suggestion: Line 47 Fix the '<<=' assignment with '@='