clash-lang / clash-compiler

Haskell to VHDL/Verilog/SystemVerilog compiler
https://clash-lang.org/
Other
1.44k stars 154 forks source link

Produced VHDL cannot be used within Vivado block designs #2636

Open bgamari opened 10 months ago

bgamari commented 10 months ago

It turns out that Vivado's block design facility has the annoyingly arbitrary limitation that ports may only be of type std_logic or std_logic_vector. Unfortunately, this means that VHDL produced by Clash, which contains various types, cannot be used in this facility.

It would be great if there were a way to flatten ports to std_logic[_vector] to side-step this limitation.

DigitalBrains1 commented 10 months ago

I know we turn a bunch of things into std_logic_vector if you give flag -fclash-hdlsyn Vivado to clash but I forgot the details. Do you already specify that flag when you observe the problem?

If that flag doesn't do the job, would a flag that turns all ports of the topEntity into std_logic{,_vector} fit the bill or perhaps on all entities with a Synthesize annotation?

[edit] Perhaps add -fclash-no-render-enums as well (which appears to be missing from the documentation) [/edit]

bgamari commented 10 months ago

Indeed I observe the issue with -fclash-hdlsyn Vivado. Sadly -fclash-no-render-enums also does not appear to help.

In all cases I see things like: clk : in wombat_types.clk_System; and s_axi_awvalid : in wombat_types.index_2

martijnbastiaan commented 5 months ago

A workaround would be to translate to Verilog instead. Whether this is usable entirely depends on your situation of course.