clash-ghc -fhdl-syn flag

28 views
Skip to first unread message

Constantin Runge

unread,
Jun 10, 2021, 11:56:24 AMJun 10
to clash-l...@googlegroups.com
Hi everyone,

I saw Alex mention the `-fclash-hdlsyn Quartus' flag for clash's ghc and
noticed, that this flag seems to be unset in the Arrow DECA starter project.

Is there any downside to setting this flag or can one set the flag
without further thought when Quartus or Vivado is used?

On a more general note, is there any detailed documentation for ghc
itself? I only know the clash-prelude hackage and the
clash-lang.readthedocs.io docs. But I don't think, either of them
explain what the flag does.

Best and thank you all,
Constantin

Alex McKenna

unread,
Jun 10, 2021, 12:24:04 PMJun 10
to Clash - Hardware Description Language
Hi Constantin,

> Is there any downside to setting this flag or can one set the flag without further thought when Quartus or Vivado is used?

The flag exists as a way to provide workarounds for quirks/bugs which affect particular software. If you know you're always targeting a particular vendor tool then there's no harm always setting it, but it won't drastically change the quality of the output HDL (it doesn't for example introduce additional optimizations). A caveat is that one tool's workaround for a quirk may overlap with a quirk in another tool, so using -fclash-hdl-syn Quartus and then running the code in Vivado may introduce problems (I don't know of any cases where it would, but that doesn't mean there aren't any. This would naturally only matter if you wanted to try the same design on FPGAs from different vendors though).

> On a more general note, is there any detailed documentation for ghc itself?

GHC has a lot of quality documentation, you can find the latest GHC User's Guide here.
You've probably already seen because you linked Clash's readthedocs, but for anyone else interested additional flags for Clash are described there.

Let me know if you have any further questions

  - Alex

Constantin Runge

unread,
Jun 11, 2021, 11:09:23 AMJun 11
to clash-l...@googlegroups.com
Hi Alex,

thanks for the explanation.

> Let me know if you have any further questions

Is there any detailed documentation on what synthesis behavior the flags
toggle?

Best,
Constantin

On 10.06.21 18:24, Alex McKenna wrote:
> Hi Constantin,
>
> > Is there any downside to setting this flag or can one set the flag
> without further thought when Quartus or Vivado is used?
>
> The flag exists as a way to provide workarounds for quirks/bugs which
> affect particular software. If you know you're always targeting a
> particular vendor tool then there's no harm always setting it, but it
> won't drastically change the quality of the output HDL (it doesn't for
> example introduce additional optimizations). A caveat is that one tool's
> workaround for a quirk may overlap with a quirk in another tool, so
> using -fclash-hdl-syn Quartus and then running the code in Vivado may
> introduce problems (I don't know of any cases where it would, but that
> doesn't mean there aren't any. This would naturally only matter if you
> wanted to try the same design on FPGAs from different vendors though).
>
> > On a more general note, is there any detailed documentation for ghc
> itself?
>
> GHC has a lot of quality documentation, you can find the latest GHC
> User's Guide here
> <https://downloads.haskell.org/ghc/latest/docs/html/users_guide/>.
> You've probably already seen because you linked Clash's readthedocs, but
> for anyone else interested additional flags for Clash are described
> there
> <https://clash-lang.readthedocs.io/en/latest/developing-hardware/flags.html>.
>
> Let me know if you have any further questions
>
>   - Alex
> On Thursday, 10 June 2021 at 17:56:24 UTC+2 c.r...@cssbook.de wrote:
>
> Hi everyone,
>
> I saw Alex mention the `-fclash-hdlsyn Quartus' flag for clash's ghc
> and
> noticed, that this flag seems to be unset in the Arrow DECA starter
> project.
>
> Is there any downside to setting this flag or can one set the flag
> without further thought when Quartus or Vivado is used?
>
> On a more general note, is there any detailed documentation for ghc
> itself? I only know the clash-prelude hackage and the
> clash-lang.readthedocs.io <http://clash-lang.readthedocs.io> docs.
> But I don't think, either of them
> explain what the flag does.
>
> Best and thank you all,
> Constantin
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clash - Hardware Description Language" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to clash-languag...@googlegroups.com
> <mailto:clash-languag...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/clash-language/335de48b-0989-4a1a-8fc8-cd3dd04d6be6n%40googlegroups.com
> <https://groups.google.com/d/msgid/clash-language/335de48b-0989-4a1a-8fc8-cd3dd04d6be6n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Alex McKenna

unread,
Jun 11, 2021, 11:51:04 AMJun 11
to Clash - Hardware Description Language
Hi Constantin,

> Is there any detailed documentation on what synthesis behavior the flags toggle?

If you mean the -fclash-hdl-syn, not as far as I know. I believe (although someone else would have to confirm it) this flag exists to deal with situations where an EDA tool doesn't fully respect what is valid according to the standard for a particular HDL. I'm sure if there's anything more of interest one of my colleagues will chime in :)

  - Alex

Martijn Bastiaan

unread,
Jun 12, 2021, 4:43:34 PMJun 12
to clash-l...@googlegroups.com
Hi Constantin,

Welcome to the mailing list!

> Is there any detailed documentation on what synthesis behavior the flags toggle?

No, but from memory:
  • Vivado: "flattens" everything to a BitVector to work around synthesis issues when trying to put "custom" types in a blockram.
  • Quartus: before Clash 1.4 it would force every identifier to become a basic one to work around an issue where Quartus would consider two variable names equal, even though the VHDL (maybe Verilog?) spec would not. Clash 1.4 overhauled the way we generate identifiers, allowing Clash to avoid these "name clashes" without resorting to drastic issues like only using basic identifiers.
We should probably take some time to confirm this^ and document it.

Cheers,
Martijn

Op vr 11 jun. 2021 om 17:51 schreef Alex McKenna <al...@qbaylogic.com>:
To unsubscribe from this group and stop receiving emails from it, send an email to clash-languag...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/clash-language/941811cb-ab7b-4ca9-a49e-01718435d915n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages