Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slightly modernize compiler Verilog output #294

Closed

Commits on Feb 25, 2021

  1. fix(comp): nest translate_{on,off} for initial blocks

    Synthesis tools like Yosys hate Synopsys pragmas, though they're
    supported (it doesn't support simulation constructs anyway, which is
    why.) It encourages `ifdef`s in order to handle this case, and always
    defines `YOSYS` to help -- they're more flexible and explicit.
    
    Currently for `initial` blocks in simulation that set initial register
    values, we use `translate_off` pragma to have the synthesis tool ignore
    things. But that block is already gated by `BSV_NO_INITIAL_BLOCKS` (so
    you can simulate without bogus default register content). So we extend
    that a bit.
    
    By nesting the `translate_off` and `_on` pragmas *inside* of an `ifndef
    YOSYS` clause (next to the `BSV_NO_INITIAL_BLOCKS` clause), Yosys will
    ignore the synopsys pragmas, and issue no warning for them at all.
    
    In the future, other tools or pragmas could be added to this chain,
    though this really is a specific workaround for a specific tool, to some
    extent.
    
    Though this also makes the resulting code *look* better IMO, since it
    scopes the pragma closer to its use site.
    
    Signed-off-by: Austin Seipp <[email protected]>
    thoughtpolice committed Feb 25, 2021
    Configuration menu
    Copy the full SHA
    5f8bb7e View commit details
    Browse the repository at this point in the history
  2. fix(comp): use verilog attributes for {parallel, full}_case modifiers

    Verilog 2001 attributes are supported by Vivado, Quartus, and other
    tools (like Yosys) in order to parallel/full case semantics. Usage of
    synopsys-specific synthesis comments can be done better this way, and it
    suppresses a real warning with Yosys.
    
    This takes us *out* of v95 territory, because Verilog attributes were
    added in Verilog 2001. Currently, no fallback is supported, though this
    could be fixed. It's unclear to me how much this harms "portability" of
    the output Verilog code, but such features can always be added back
    later on demand...
    
    Signed-off-by: Austin Seipp <[email protected]>
    thoughtpolice committed Feb 25, 2021
    Configuration menu
    Copy the full SHA
    45b3593 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    94da12c View commit details
    Browse the repository at this point in the history