From d72a7b7e1ee6c257e789d36d77e974bd97aac8fa Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Mon, 9 Jan 2023 20:59:27 -0500 Subject: [PATCH] Add LFSR Add an LFSR library. It will be used to calculate CRCs (for now). Signed-off-by: Sean Anderson --- .gitmodules | 3 +++ LICENSES/MIT.txt | 19 +++++++++++++++++++ Makefile | 10 ++++++++-- lib/verilog-lfsr | 1 + 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 .gitmodules create mode 100644 LICENSES/MIT.txt create mode 160000 lib/verilog-lfsr diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..25d783d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "verilog-lfsr"] + path = lib/verilog-lfsr + url = ../verilog-lfsr.git diff --git a/LICENSES/MIT.txt b/LICENSES/MIT.txt new file mode 100644 index 0000000..1b8f1ce --- /dev/null +++ b/LICENSES/MIT.txt @@ -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. diff --git a/Makefile b/Makefile index eceb588..9e689ff 100644 --- a/Makefile +++ b/Makefile @@ -18,8 +18,13 @@ FORCE: log: mkdir $@ +LIBDIRS := rtl lib/verilog-lfsr/rtl %.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) $( $@ @@ -36,7 +41,8 @@ IFLAGS := -g2012 -gspecify -Wall -Wno-timescale EXTRA_V := rtl/iverilog_dump.v define run-icarus = -$(ICARUS) $(IFLAGS) -I$( $@.d; RET=$$?; rm -f $@.pre; exit $$RET endef diff --git a/lib/verilog-lfsr b/lib/verilog-lfsr new file mode 160000 index 0000000..2ae88c6 --- /dev/null +++ b/lib/verilog-lfsr @@ -0,0 +1 @@ +Subproject commit 2ae88c6953d7434411c0f90f9f09e78c2361a6ad