Add an LFSR library. It will be used to calculate CRCs (for now).

Signed-off-by: Sean Anderson <seanga2@gmail.com>
This commit is contained in:
Sean Anderson 2023-01-09 20:59:27 -05:00
parent 83216ea1e9
commit d72a7b7e1e
4 changed files with 31 additions and 2 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "verilog-lfsr"]
path = lib/verilog-lfsr
url = ../verilog-lfsr.git

19
LICENSES/MIT.txt Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2016 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -18,8 +18,13 @@ FORCE:
log: log:
mkdir $@ mkdir $@
LIBDIRS := rtl lib/verilog-lfsr/rtl
%.synth.json: %.v | log %.synth.json: %.v | log
$(SYNTH) -q -E $@.d -p "synth_ice40 -top $(*F)" -b json -o $@ -f verilog $< -l log/$(*F).synth ( \
echo "read_verilog -sv $<"; \
echo "hierarchy $(addprefix -libdir ,$(LIBDIRS) $(<D))"; \
echo "synth_ice40 -top $(*F)"; \
) | $(SYNTH) -q -E $@.d -s /dev/stdin -b json -o $@ -l log/$(*F).synth
define run-jsontov = define run-jsontov =
( grep timescale $*.v; $(SYNTH) -q -p "write_verilog -defparam -noattr" -f json $< ) > $@ ( grep timescale $*.v; $(SYNTH) -q -p "write_verilog -defparam -noattr" -f json $< ) > $@
@ -36,7 +41,8 @@ IFLAGS := -g2012 -gspecify -Wall -Wno-timescale
EXTRA_V := rtl/iverilog_dump.v EXTRA_V := rtl/iverilog_dump.v
define run-icarus = define run-icarus =
$(ICARUS) $(IFLAGS) -I$(<D) -y$(<D) -M$@.pre -DTOP=$(TOP) -s $(TOP) -s iverilog_dump -o $@ $< $(EXTRA_V) && \ $(ICARUS) $(IFLAGS) -I$(<D) $(addprefix -y,$(LIBDIRS) $(<D)) -M$@.pre -DTOP=$(TOP) \
-s $(TOP) -s iverilog_dump -o $@ $< $(EXTRA_V) && \
( echo -n "$@: " && tr '\n' ' ' ) < $@.pre > $@.d; RET=$$?; rm -f $@.pre; exit $$RET ( echo -n "$@: " && tr '\n' ' ' ) < $@.pre > $@.d; RET=$$?; rm -f $@.pre; exit $$RET
endef endef

1
lib/verilog-lfsr Submodule

@ -0,0 +1 @@
Subproject commit 2ae88c6953d7434411c0f90f9f09e78c2361a6ad