-
Notifications
You must be signed in to change notification settings - Fork 154
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
Fix VHDL and SystemVerilog gen for Xilinx oddr
#2833
base: master
Are you sure you want to change the base?
Conversation
Of course, while we didn't have Vivado back when the bug was introduced, we do now. Maybe it's even worth it to make a combined test with IDDR and ODDR prims, but just a "does this generate HDL" test is much more quickly written. Anyway, the names in HDL are a bit weird: D1 => dataout_l(i), -- 1-bit data input (positive edge)
D2 => dataout_h(i), -- 1-bit data input (negative edge) Why is the data for the positive edge labeled L and the data for the negative edge labeled H? Note that |
I think they're called like that due to copy/paste from the Intel primitives where the output ports of the Intel primivite are called clash-compiler/clash-lib/prims/vhdl/Clash_Intel_DDR.primitives.yaml Lines 43 to 44 in 5706eaf
|
Shall I name them more obviously in this PR as well? I'm thinking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please clean up the names, and also it would be nice if we tested these primitives on Vivado at least in nightly builds. I mean... we already do that for the generic DDRout primitives:
Lines 517 to 526 in 10f26ff
, let _opts = def{ buildTargets = BuildSpecific [ "testBenchUA" | |
, "testBenchUS" | |
, "testBenchGA" | |
, "testBenchGS" | |
] | |
, hdlLoad = [Vivado] | |
, hdlSim = [Vivado] | |
, clashFlags=["-fclash-hdlsyn", "Vivado"] | |
} | |
in runTest "DDRout" _opts |
`Clash.Explicit.DDR.ddrOut`: VHDL: Fix incorrect usage of `Enable` signal. With asynchronous resets, the `Enable` was not connected to the registers. Furthermore, the `Enable` was combinatorially(!) connected to the mux that selects the output. The mux should not be affected by the `Enable` at all (with the current Haskell simulation model). `Clash.Xilinx.DDR`: - `oddr`: Verilog correctly picked one of the possible arguments to inspect for `ResetKind`, but the others picked the `KnownNat` constraint. This caused Clash to error out during HDL generation. - Both in and out prims: Renamed symbols that were incorrectly copy-pasted from the Intel prims. `Clash.Intel.DDR`: - `altddioOut`: VHDL: Several numeric identifiers were incorrect, referring to wrong arguments or symbols. HDL generation completed without error, but the resulting VHDL was completely broken. - Both prims: evaluate the `SSymbol` in Haskell to fix HDL generation warning about using an argument that is unused in Haskell. Note that the DDR input primitives were not checked to work correctly (but the next commit adds a test bench for Xilinx iddr). This PR purely fixes stuff related to the /output/ primitives, with really minor adjustments to the input primitives.
The existing test benches for the generic primitives (in `tests/shouldwork/DDR`) could be copied verbatim to test the Xilinx DDR primitives.
56f9f38
to
e77b004
Compare
Note to self: to do: run the nightly tests on a temporary branch to be absolutely sure they did not break. The changed test benches were run succesfully under a single configuration on my laptop, but CI will test a whole bunch of configurations. |
Verilog correctly picked one of the possible arguments to inspect for
ResetKind
, but the others picked theKnownNat
constraint.This lead to the following error message:
Without Vivado, we can't actually test these primitives. However, here they already errored out during HDL generation. Perhaps we should add a "HDL generation only" test for all primitives that don't yet occur in any of the other tests in the test suite. This would have caught this particular bug.
The bug was introduced in 2019 in commit 0c38d65 part of PR #527.
Still TODO: