Repository navigation
Changed:
-
Clash now derives more names in the generated HDL from the source code:
- Arguments of data constructors are named after the record field they are passed to, e.g.
c$baudCountinstead ofc$app_argfor the second field ofTx { txState, baudCount }. - Arguments of functions are named after the function and its parameter, e.g.
c$txStep_sfor the state ofmealy txStep. - Case alternatives are named after the constructor they match, e.g.
c$x_case_Idleinstead ofc$x_case_altfor the alternativeIdle -> ...ofx = case s of .... - Pattern bindings such as
(nextState, output) = ...are named after their variables, e.g.nextState_outputinstead ofds. - Variables made up by GHC, such as
eta, are named after the parameter of the user-defined function they're passed to. This also names ports of top entities without aSynthesizeannotation. - User-written names are kept when they are aliases of variables Clash made up. For example,
dSCLinlet dSCL = fst _dI2Cnow names the register holding that field.
- Arguments of data constructors are named after the record field they are passed to, e.g.
-
Fields of SystemVerilog structs for records are now named after the record fields, e.g.
baudCountinstead ofTx_sel1for the fieldbaudCountof a recordTx. When a record field isn't a valid SystemVerilog identifier, such as a keyword likeinputor a name with a', the struct's fields are named likeTx_sel1_baudCountinstead. Fields of tuples and other products without field names keep names likeTuple2_sel0.
#3503 -
Removing unused declarations no longer shuffles the order of the remaining declarations in the generated HDL.
#3503 -
Comparing constructors of enumerations with derived
==, such asmode == Done, no longer produces anInt-wide signal namedc$case_scrutin the HDL.
#3503 -
Alternatives of case statements in the generated HDL now mention the constructor they match in a comment, e.g.
2'b00 : busy = 1'b0; // Idle.
#3503 -
Signals holding a record field that the HDL matches on are now named after the record and the field, e.g.
s_modefor the fieldmodeof a signals.
#3503 -
Clash now reports errors in the module it compiles directly, instead of wrapping them in a message about loading the module from both precompiled and local sources.
#2365 #2680 -
Improved the documentation on converting between number types.
#3537 -
The error for an inline primitive with a mismatched name now points at the annotated function.
#2365
Fixed:
- Clash's internal
split#unfolding now returns zero for zero-width halves, matching its Haskell counterpart.
#3490 GHC.Num.Integer.integerLogBase#andGHC.Num.Natural.naturalLogBase#are now constant folded accurately, even in cases where these functions return errors.
#3492- Unhandled
errorcalls are reported with theirHasCallStackbacktrace again on GHC 9.12 and later.
#3449 - Errors raised while compiling top entities concurrently now report the backtrace they were thrown with, instead of one pointing into
async.
#3449 - Clash no longer takes quadratic or exponential time to compile designs that use
iterateIwith a function that inspects its argument more than once, e.g.iterateI (\(Just n) -> if n == maxBound then Nothing else Just (n + 1)) (Just 0), when the resulting vector is consumed by functions such astakeIorfoldr.
#3477 #3539 - Clash now reports an error when
clash-lib'smkFunInputgets called with a local variable as its function input.
#3499 - The VHDL backend now generates valid VHDL for entities without ports, such as a top entity whose ports are all zero-width. This can be helpful when creating self-contained VHDL test benches.
#3500 - Clash's evaluator no longer produces an
SNatnewtype constructor when evaluatingwithSomeSNat.
#3491 - Clash no longer crashes on
iterateIwith functions such asmap forresize.
#3495 - Constant
BitVectorindices in Verilog and SystemVerilog are now rendered as plain integers, avoiding64'sdprefixes that caused warnings in tools such as Verilator.
#3056 - Clash no longer duplicates components whose result is projected out of more than once.
#3517 #3519 - Clash no longer duplicates components when applying a primitive to another instantiation of a primitive in certain situations.
#3516 #3518 - Clash now reports a clear error for functions returning a non-representable type that it can't inline away.
#3521 - Generating Verilog or SystemVerilog for
BitVectorindexing now uses the built-in blackbox function directly, avoiding unnecessary interpreter sessions that slowed compilation and could crash the compiler.
#3522