phanrahan/mantle

Flip Flops and Counters Potentially Broken

David-Durst opened this issue · 1 comments

I get the following compile error when I try to use DFFs, SRFFs, TFFs, and UpDownCounters:

bash-3.2$ ./testTFFbuild.sh
import mantle lattice ice40
import mantle lattice mantle40
compiling main
ERROR: Parameter inst0.has_set with non-constant value at build/testTFF.v:4!
fatal error: read_blif: failed to open `build/testTFF.blif': No such file or directory
Error: Failed to open input file.
iceprog: can't open 'build/testTFF.bin' for reading: No such file or directory
bash-3.2$ 

I have created a minimum repro of the bug at https://github.com/David-Durst/CS448H-answers/blob/TFFissue/lab2/testTFF.py. If you checkout that repo, you can run the script testTFFbuild.sh in the lab2 folder to repro the bug. Note that the repo is private since it contains my answers for the two labs and I want to allow you guys to reuse the projects in the future. You all have been invited to collaborate on it.

This is an issue with a bug in the documentation as well as poor error handling. Opened a magma issue here: phanrahan/magma#136

Fix has been pushed to your repo (TFFissue branch) which just removes the bad parameters. Documentation needs to be updated, but for now the code (in this case: https://github.com/phanrahan/mantle/blob/master/mantle/lattice/mantle40/FF.py) holds the true set of valid parameters.