Skip to content

Commit 0120741

Browse files
committed
adding files
1 parent 3cef4b1 commit 0120741

26 files changed

+1877954
-0
lines changed

.github/workflows/regress.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: regress
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
11+
BUILD_TYPE: Debug
12+
13+
jobs:
14+
build:
15+
# The CMake configure and build commands are platform agnostic and should work equally
16+
# well on Windows or Mac. You can convert this to a matrix build if you need
17+
# cross-platform coverage.
18+
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
submodules: true
25+
26+
- name: create docker regress image
27+
run: docker build . --file Dockerfile.regress -t regress
28+
29+
- name: run regress
30+
run: docker run regress

.gitignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
*~
2+
*.log
3+
*.pyc
4+
*.snl
5+
*.mf
6+
*/*/primitives.v
7+
*/*/verif.*
8+
*/*/verilator.gold
9+
designs/adder/adder_snl.v
10+
designs/arm_core/arm_core_netlist.v
11+
designs/arm_core/arm_core_snl_error.v
12+
designs/arm_core/arm_core_snl.v
13+
designs/arm_core/*.list

Dockerfile.regress

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# SPDX-FileCopyrightText: 2024 The Naja authors <https://github.com/najaeda/naja/blob/main/AUTHORS>
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
FROM alpine:3.19.1 as builder
6+
7+
# Install required packages
8+
RUN apk --no-cache add ca-certificates
9+
RUN apk update && apk upgrade
10+
RUN apk add --no-cache \
11+
autoconf automake \
12+
g++ python3 make \
13+
flex-dev bison \
14+
help2man
15+
16+
#compile verilator
17+
RUN wget https://github.com/verilator/verilator/archive/refs/tags/v5.022.tar.gz
18+
RUN tar xvzf v5.022.tar.gz
19+
WORKDIR /verilator-5.022
20+
RUN autoconf && ./configure --prefix=/verilator-install && make -j$(nproc)
21+
RUN make install
22+
23+
#compile yosys
24+
RUN apk add pkgconfig tcl-dev readline-dev libffi-dev git
25+
WORKDIR /
26+
RUN wget https://github.com/YosysHQ/yosys/archive/refs/tags/yosys-0.38.tar.gz
27+
RUN tar xvzf yosys-0.38.tar.gz
28+
WORKDIR /yosys-yosys-0.38
29+
RUN make config-gcc
30+
RUN make -j$(nproc)
31+
RUN make install PREFIX=/yosys-install
32+
33+
#compile naja
34+
RUN apk add cmake \
35+
capnproto capnproto-dev \
36+
python3-dev \
37+
boost-dev onetbb-dev
38+
COPY / /naja
39+
RUN rm -rf /naja/build
40+
RUN rm -rf /naja-install
41+
WORKDIR /naja/build
42+
RUN cmake .. -DCMAKE_INSTALL_PREFIX=/naja-install && make -j$(nproc) && make install
43+
44+
WORKDIR /naja/regress
45+
ENV SET_PYTHONPATH=/naja-install/lib/python
46+
ENV LD_LIBRARY_PATH=/naja-install/lib
47+
ENV NAJA_EDIT=/naja-install/bin/naja_edit
48+
ENV PRIMITIVES=/naja-install/shared/primitives/xilinx.py
49+
ENV YOSYS=/yosys-install/bin/yosys
50+
ENV VERILATOR=/verilator-install/bin/verilator
51+
CMD /yosys-install/bin/yosys -V; /verilator-install/bin/verilator -V; make clean; make

designs/Makefile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
all:
2+
cd adder && make
3+
cd arm_core && make
4+
cd test_args && make
5+
#cd vexriscv && make
6+
cd jpeg && make
7+
cd black_parrot && make
8+
9+
clean:
10+
cd adder && make clean
11+
cd arm_core && make clean
12+
cd test_args && make clean
13+
cd vexriscv && make clean
14+
cd jpeg && make clean
15+
cd black_parrot && make clean

designs/Makefile.inc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
YOSYS ?= yosys
2+
EQY ?= eqy
3+
VERILATOR ?= verilator
4+
NAJA_EDIT ?= $(NAJA_INSTALL)/bin/naja_edit
5+
PRIMITIVES ?= $(NAJA_INSTALL)/shared/primitives/xilinx.py
6+
ASAP7_PRIMITIVES ?= $(NAJA_INSTALL)/shared/primitives/asap7.py
7+
NANGATE45_PRIMITIVES ?= $(NAJA_INSTALL)/shared/primitives/nangate45.py
8+
SET_PYTHONPATH ?= $(NAJA_INSTALL)/lib/python

designs/adder/Makefile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
include ../Makefile.inc
2+
3+
all: adder_snl.v primitives.v verilator
4+
5+
verilator: adder_snl.v primitives.v
6+
${VERILATOR} --top-module adder --lint-only primitives.v adder_snl.v
7+
8+
adder_netlist.v: src/adder.v
9+
${YOSYS} src/synth.ys
10+
11+
adder_snl.v primitives.v: adder_netlist.v
12+
export PYTHONPATH=${SET_PYTHONPATH}; \
13+
${NAJA_EDIT} -f verilog -t verilog -p ${PRIMITIVES} -i $< -o adder_snl.v -d primitives.v
14+
15+
clean:
16+
-rm adder_snl.v primitives.v adder_netlist.v

designs/adder/adder_netlist.v

+171
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
/* Generated by Yosys 0.38 (git sha1 543faed9c8c, clang 15.0.0 -fPIC -Os) */
2+
3+
(* top = 1 *)
4+
(* src = "src/adder.v:1.1-8.10" *)
5+
module adder(a, b, s);
6+
wire _00_;
7+
(* force_downto = 32'd1 *)
8+
(* src = "/opt/homebrew/bin/../share/yosys/xilinx/lut_map.v:30.21-30.22" *)
9+
wire [1:0] _01_;
10+
(* force_downto = 32'd1 *)
11+
(* src = "/opt/homebrew/bin/../share/yosys/xilinx/lut_map.v:30.21-30.22" *)
12+
wire [5:0] _02_;
13+
(* force_downto = 32'd1 *)
14+
(* src = "/opt/homebrew/bin/../share/yosys/xilinx/lut_map.v:30.21-30.22" *)
15+
wire [3:0] _03_;
16+
(* force_downto = 32'd1 *)
17+
(* src = "/opt/homebrew/bin/../share/yosys/xilinx/lut_map.v:30.21-30.22" *)
18+
wire [1:0] _04_;
19+
(* force_downto = 32'd1 *)
20+
(* src = "/opt/homebrew/bin/../share/yosys/xilinx/lut_map.v:30.21-30.22" *)
21+
wire [5:0] _05_;
22+
(* src = "src/adder.v:2.14-2.15" *)
23+
input [7:0] a;
24+
wire [7:0] a;
25+
(* src = "src/adder.v:3.14-3.15" *)
26+
input [7:0] b;
27+
wire [7:0] b;
28+
(* src = "src/adder.v:4.10-4.11" *)
29+
output s;
30+
wire s;
31+
(* module_not_derived = 32'd1 *)
32+
(* src = "/opt/homebrew/bin/../share/yosys/xilinx/lut_map.v:61.26-63.41" *)
33+
LUT6 #(
34+
.INIT(64'hefffffffffffffff)
35+
) _06_ (
36+
.I0(_05_[0]),
37+
.I1(_05_[1]),
38+
.I2(_05_[2]),
39+
.I3(_05_[3]),
40+
.I4(_05_[4]),
41+
.I5(_05_[5]),
42+
.O(_00_)
43+
);
44+
(* module_not_derived = 32'd1 *)
45+
(* src = "/opt/homebrew/bin/../share/yosys/xilinx/lut_map.v:43.26-44.30" *)
46+
LUT2 #(
47+
.INIT(4'h1)
48+
) _07_ (
49+
.I0(_04_[0]),
50+
.I1(_04_[1]),
51+
.O(_05_[4])
52+
);
53+
(* module_not_derived = 32'd1 *)
54+
(* src = "/opt/homebrew/bin/../share/yosys/xilinx/lut_map.v:61.26-63.41" *)
55+
LUT6 #(
56+
.INIT(64'h0000000000000001)
57+
) _08_ (
58+
.I0(_02_[0]),
59+
.I1(_02_[1]),
60+
.I2(_02_[2]),
61+
.I3(_02_[3]),
62+
.I4(_02_[4]),
63+
.I5(_02_[5]),
64+
.O(_05_[5])
65+
);
66+
(* module_not_derived = 32'd1 *)
67+
(* src = "/opt/homebrew/bin/../share/yosys/xilinx/lut_map.v:43.26-44.30" *)
68+
LUT2 #(
69+
.INIT(4'h1)
70+
) _09_ (
71+
.I0(_01_[0]),
72+
.I1(_01_[1]),
73+
.O(_05_[2])
74+
);
75+
(* module_not_derived = 32'd1 *)
76+
(* src = "/opt/homebrew/bin/../share/yosys/xilinx/lut_map.v:51.26-53.19" *)
77+
LUT4 #(
78+
.INIT(16'h0001)
79+
) _10_ (
80+
.I0(_03_[0]),
81+
.I1(_03_[1]),
82+
.I2(_03_[2]),
83+
.I3(_03_[3]),
84+
.O(_05_[3])
85+
);
86+
(* keep = 32'd1 *)
87+
IBUF _11_ (
88+
.I(a[0]),
89+
.O(_02_[0])
90+
);
91+
(* keep = 32'd1 *)
92+
IBUF _12_ (
93+
.I(a[1]),
94+
.O(_03_[0])
95+
);
96+
(* keep = 32'd1 *)
97+
IBUF _13_ (
98+
.I(a[2]),
99+
.O(_04_[0])
100+
);
101+
(* keep = 32'd1 *)
102+
IBUF _14_ (
103+
.I(a[3]),
104+
.O(_02_[1])
105+
);
106+
(* keep = 32'd1 *)
107+
IBUF _15_ (
108+
.I(a[4]),
109+
.O(_03_[1])
110+
);
111+
(* keep = 32'd1 *)
112+
IBUF _16_ (
113+
.I(a[5]),
114+
.O(_01_[0])
115+
);
116+
(* keep = 32'd1 *)
117+
IBUF _17_ (
118+
.I(a[6]),
119+
.O(_05_[0])
120+
);
121+
(* keep = 32'd1 *)
122+
IBUF _18_ (
123+
.I(a[7]),
124+
.O(_03_[2])
125+
);
126+
(* keep = 32'd1 *)
127+
IBUF _19_ (
128+
.I(b[0]),
129+
.O(_05_[1])
130+
);
131+
(* keep = 32'd1 *)
132+
IBUF _20_ (
133+
.I(b[1]),
134+
.O(_02_[2])
135+
);
136+
(* keep = 32'd1 *)
137+
IBUF _21_ (
138+
.I(b[2]),
139+
.O(_02_[3])
140+
);
141+
(* keep = 32'd1 *)
142+
IBUF _22_ (
143+
.I(b[3]),
144+
.O(_01_[1])
145+
);
146+
(* keep = 32'd1 *)
147+
IBUF _23_ (
148+
.I(b[4]),
149+
.O(_02_[4])
150+
);
151+
(* keep = 32'd1 *)
152+
IBUF _24_ (
153+
.I(b[5]),
154+
.O(_04_[1])
155+
);
156+
(* keep = 32'd1 *)
157+
IBUF _25_ (
158+
.I(b[6]),
159+
.O(_03_[3])
160+
);
161+
(* keep = 32'd1 *)
162+
IBUF _26_ (
163+
.I(b[7]),
164+
.O(_02_[5])
165+
);
166+
(* keep = 32'd1 *)
167+
OBUF _27_ (
168+
.I(_00_),
169+
.O(s)
170+
);
171+
endmodule

designs/adder/src/adder.v

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module adder(a, b, s);
2+
input [7:0] a;
3+
input [7:0] b;
4+
output s;
5+
6+
assign s = a || b;
7+
8+
endmodule

designs/adder/src/comp.ys

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# gold design
2+
read_verilog primitives.v arm_core_netlist.v
3+
prep -top arm_core
4+
splitnets -ports;;
5+
design -stash gold
6+
7+
#naja design
8+
read_verilog primitives.v arm_core_snl.v
9+
prep -top arm_core
10+
splitnets -ports;;
11+
design -stash naja
12+
13+
# prove equivalence
14+
design -copy-from gold -as gold arm_core
15+
design -copy-from naja -as naja arm_core
16+
equiv_make gold naja equiv
17+
hierarchy -top equiv
18+
equiv_simple
19+
equiv_status -assert

designs/adder/src/synth.ys

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
read_verilog src/adder.v
2+
synth_xilinx -top adder
3+
write_verilog adder_netlist.v

designs/arm_core/Makefile

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
include ../Makefile.inc
2+
3+
all: edges.list verif.gold verilator.gold verif.error
4+
5+
verif.error: arm_core_snl_error.v primitives.v
6+
${YOSYS} src/comp_error.ys
7+
touch $@
8+
9+
verif.gold: arm_core_snl.v primitives.v
10+
${YOSYS} src/comp_gold.ys
11+
touch $@
12+
13+
eqy.gold: arm_core_snl.v primitives.v
14+
-rm -rf comp
15+
${EQY} src/comp.eqy
16+
touch $@
17+
18+
verilator.gold: arm_core_snl.v primitives.v
19+
${VERILATOR} --top-module arm_core --lint-only primitives.v arm_core_snl.v
20+
touch $@
21+
22+
arm_core_netlist.v: src/arm_core.v
23+
${YOSYS} src/synth.ys
24+
25+
arm_core_snl/snl.mf: arm_core_netlist.v
26+
export PYTHONPATH=${SET_PYTHONPATH}; \
27+
${PYTHON_ENV} ${NAJA_EDIT} -f verilog -t snl -i $< -o arm_core_snl -p ${PRIMITIVES}
28+
29+
edges.list: arm_core_snl/snl.mf gen_edge_list.py
30+
export PYTHONPATH=${SET_PYTHONPATH}; \
31+
${NAJA_EDIT} -f snl -i arm_core_snl -e gen_edge_list.py
32+
33+
arm_core_snl.v primitives.v: arm_core_netlist.v
34+
export PYTHONPATH=${SET_PYTHONPATH}; \
35+
${NAJA_EDIT} -f verilog -t verilog -p ${PRIMITIVES} -i arm_core_netlist.v -o arm_core_snl.v -d primitives.v
36+
37+
arm_core_snl_error.v: arm_core_netlist.v src/add_error.py
38+
export PYTHONPATH=${SET_PYTHONPATH}; \
39+
${NAJA_EDIT} -e src/add_error.py -f verilog -t verilog -p ${PRIMITIVES} -i arm_core_netlist.v -o arm_core_snl_error.v -d primitives.v
40+
41+
clean:
42+
-rm arm_core_snl.v primitives.v arm_core_netlist.v

0 commit comments

Comments
 (0)