add chips/yosys (part 6)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- chips/yosys/tests/arch/analogdevices/dsp_abc9.ys +41 -0
- chips/yosys/tests/arch/analogdevices/fsm.ys +20 -0
- chips/yosys/tests/arch/analogdevices/generate_mk.py +9 -0
- chips/yosys/tests/arch/analogdevices/logic.ys +11 -0
- chips/yosys/tests/arch/analogdevices/lutram.ys +113 -0
- chips/yosys/tests/arch/analogdevices/mem_gen.py +121 -0
- chips/yosys/tests/arch/analogdevices/mul.ys +9 -0
- chips/yosys/tests/arch/analogdevices/mul_unsigned.v +30 -0
- chips/yosys/tests/arch/analogdevices/mul_unsigned.ys +10 -0
- chips/yosys/tests/arch/analogdevices/mux.ys +50 -0
- chips/yosys/tests/arch/analogdevices/opt_lut_ins.ys +26 -0
- chips/yosys/tests/arch/analogdevices/shifter.ys +10 -0
- chips/yosys/tests/arch/anlogic/.gitignore +2 -0
- chips/yosys/tests/arch/anlogic/add_sub.ys +10 -0
- chips/yosys/tests/arch/anlogic/blockram.ys +13 -0
- chips/yosys/tests/arch/anlogic/counter.ys +11 -0
- chips/yosys/tests/arch/anlogic/dffs.ys +19 -0
- chips/yosys/tests/arch/anlogic/fsm.ys +15 -0
- chips/yosys/tests/arch/anlogic/generate_mk.py +8 -0
- chips/yosys/tests/arch/anlogic/latches.ys +35 -0
- chips/yosys/tests/arch/anlogic/logic.ys +11 -0
- chips/yosys/tests/arch/anlogic/lutram.ys +20 -0
- chips/yosys/tests/arch/anlogic/mux.ys +50 -0
- chips/yosys/tests/arch/anlogic/shifter.ys +10 -0
- chips/yosys/tests/arch/anlogic/tribuf.ys +9 -0
- chips/yosys/tests/arch/common/add_sub.v +12 -0
- chips/yosys/tests/arch/common/adffs.v +51 -0
- chips/yosys/tests/arch/common/blockram.v +327 -0
- chips/yosys/tests/arch/common/blockrom.v +35 -0
- chips/yosys/tests/arch/common/counter.v +11 -0
- chips/yosys/tests/arch/common/dffs.v +15 -0
- chips/yosys/tests/arch/common/fsm.v +51 -0
- chips/yosys/tests/arch/common/latches.v +21 -0
- chips/yosys/tests/arch/common/logic.v +16 -0
- chips/yosys/tests/arch/common/lutram.v +42 -0
- chips/yosys/tests/arch/common/memory_attributes/attributes_test.v +87 -0
- chips/yosys/tests/arch/common/mul.v +10 -0
- chips/yosys/tests/arch/common/mux.v +60 -0
- chips/yosys/tests/arch/common/shifter.v +17 -0
- chips/yosys/tests/arch/common/tribuf.v +8 -0
- chips/yosys/tests/arch/ecp5/abc9_inout_pad_input.ys +21 -0
- chips/yosys/tests/arch/ecp5/add_sub.ys +11 -0
- chips/yosys/tests/arch/ecp5/adffs.ys +40 -0
- chips/yosys/tests/arch/ecp5/bug1459.ys +25 -0
- chips/yosys/tests/arch/ecp5/bug1598.ys +16 -0
- chips/yosys/tests/arch/ecp5/bug1630.il.gz +3 -0
- chips/yosys/tests/arch/ecp5/bug1630.ys +2 -0
- chips/yosys/tests/arch/ecp5/bug1836.mem +32 -0
- chips/yosys/tests/arch/ecp5/bug1836.ys +23 -0
- chips/yosys/tests/arch/ecp5/bug2409.ys +24 -0
chips/yosys/tests/arch/analogdevices/dsp_abc9.ys
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
logger -nowarn "Yosys has only limited support for tri-state logic at the moment\. .*"
|
| 2 |
+
logger -nowarn "Ignoring boxed module .*\."
|
| 3 |
+
|
| 4 |
+
read_verilog <<EOT
|
| 5 |
+
module top(input [24:0] A, input [17:0] B, output [47:0] P);
|
| 6 |
+
DSP48E1 #(.PREG(0)) dsp(.A(A), .B(B), .P(P));
|
| 7 |
+
endmodule
|
| 8 |
+
EOT
|
| 9 |
+
techmap -autoproc -wb -map +/analogdevices/cells_sim.v
|
| 10 |
+
opt
|
| 11 |
+
scc -expect 0
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
design -reset
|
| 15 |
+
read_verilog <<EOT
|
| 16 |
+
module top(input signed [24:0] A, input signed [17:0] B, output [47:0] P);
|
| 17 |
+
assign P = A * B;
|
| 18 |
+
endmodule
|
| 19 |
+
EOT
|
| 20 |
+
synth_analogdevices
|
| 21 |
+
techmap -autoproc -wb -map +/analogdevices/cells_sim.v
|
| 22 |
+
opt -full -fine
|
| 23 |
+
select -assert-count 2 t:$mul
|
| 24 |
+
select -assert-count 0 t:* t:$mul %D
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
design -reset
|
| 28 |
+
read_verilog -icells -formal <<EOT
|
| 29 |
+
module top(output [43:0] P);
|
| 30 |
+
\$__MUL22X22 mul (.A(42), .B(42), .Y(P));
|
| 31 |
+
assert property (P == 42*42);
|
| 32 |
+
endmodule
|
| 33 |
+
EOT
|
| 34 |
+
async2sync
|
| 35 |
+
techmap -map +/analogdevices/dsp_map.v
|
| 36 |
+
verilog_defaults -add -D ALLOW_WHITEBOX_DSP48E1
|
| 37 |
+
synth_analogdevices
|
| 38 |
+
techmap -autoproc -wb -map +/analogdevices/cells_sim.v
|
| 39 |
+
opt -full -fine
|
| 40 |
+
select -assert-count 0 t:* t:$assert %d
|
| 41 |
+
sat -verify -prove-asserts
|
chips/yosys/tests/arch/analogdevices/fsm.ys
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog ../common/fsm.v
|
| 2 |
+
hierarchy -top fsm
|
| 3 |
+
proc
|
| 4 |
+
flatten
|
| 5 |
+
|
| 6 |
+
design -save orig
|
| 7 |
+
|
| 8 |
+
equiv_opt -run :prove -map +/analogdevices/cells_sim.v synth_analogdevices -noiopad
|
| 9 |
+
miter -equiv -make_assert -flatten gold gate miter
|
| 10 |
+
sat -verify -prove-asserts -show-public -set-at 1 in_reset 1 -seq 20 -prove-skip 1 miter
|
| 11 |
+
|
| 12 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 13 |
+
cd fsm # Constrain all select calls below inside the top module
|
| 14 |
+
stat
|
| 15 |
+
select -assert-count 6 t:FFRE
|
| 16 |
+
select -assert-count 1 t:LUT1
|
| 17 |
+
select -assert-count 1 t:LUT3
|
| 18 |
+
select -assert-count 1 t:LUT4
|
| 19 |
+
select -assert-count 5 t:LUT5
|
| 20 |
+
select -assert-none t:FFRE t:LUT1 t:LUT3 t:LUT4 t:LUT5 %% t:* %D
|
chips/yosys/tests/arch/analogdevices/generate_mk.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
|
| 3 |
+
import sys
|
| 4 |
+
sys.path.append("../..")
|
| 5 |
+
|
| 6 |
+
import gen_tests_makefile
|
| 7 |
+
import mem_gen
|
| 8 |
+
|
| 9 |
+
gen_tests_makefile.generate(["--yosys-scripts", "--bash", "--yosys-args", "-w 'Yosys has only limited support for tri-state logic at the moment.'" ])
|
chips/yosys/tests/arch/analogdevices/logic.ys
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog ../common/logic.v
|
| 2 |
+
hierarchy -top top
|
| 3 |
+
proc
|
| 4 |
+
equiv_opt -assert -map +/analogdevices/cells_sim.v synth_analogdevices -noiopad # equivalency check
|
| 5 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 6 |
+
cd top # Constrain all select calls below inside the top module
|
| 7 |
+
|
| 8 |
+
select -assert-count 4 t:LUT1
|
| 9 |
+
select -assert-count 3 t:LUT2
|
| 10 |
+
select -assert-count 2 t:LUT4
|
| 11 |
+
select -assert-none t:LUT1 t:LUT2 t:LUT4 %% t:* %D
|
chips/yosys/tests/arch/analogdevices/lutram.ys
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
design -reset
|
| 2 |
+
read_verilog ../common/lutram.v
|
| 3 |
+
hierarchy -top lutram_1w1r -chparam A_WIDTH 5
|
| 4 |
+
proc
|
| 5 |
+
memory -nomap
|
| 6 |
+
equiv_opt -run :prove -map +/analogdevices/cells_sim.v synth_analogdevices -noiopad
|
| 7 |
+
memory
|
| 8 |
+
opt -full
|
| 9 |
+
|
| 10 |
+
miter -equiv -flatten -make_assert -make_outputs gold gate miter
|
| 11 |
+
sat -verify -prove-asserts -seq 3 -set-init-zero -show-inputs -show-outputs miter
|
| 12 |
+
|
| 13 |
+
design -load postopt
|
| 14 |
+
cd lutram_1w1r
|
| 15 |
+
select -assert-count 8 t:FFRE
|
| 16 |
+
select -assert-count 8 t:RAMS64X1
|
| 17 |
+
select -assert-none t:FFRE t:RAMS64X1 %% t:* %D
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
design -reset
|
| 21 |
+
read_verilog ../common/lutram.v
|
| 22 |
+
hierarchy -top lutram_1w1r
|
| 23 |
+
proc
|
| 24 |
+
memory -nomap
|
| 25 |
+
equiv_opt -run :prove -map +/analogdevices/cells_sim.v synth_analogdevices -noiopad
|
| 26 |
+
memory
|
| 27 |
+
opt -full
|
| 28 |
+
|
| 29 |
+
miter -equiv -flatten -make_assert -make_outputs gold gate miter
|
| 30 |
+
sat -verify -prove-asserts -seq 3 -set-init-zero -show-inputs -show-outputs miter
|
| 31 |
+
|
| 32 |
+
design -load postopt
|
| 33 |
+
cd lutram_1w1r
|
| 34 |
+
dump
|
| 35 |
+
select -assert-count 8 t:FFRE
|
| 36 |
+
select -assert-count 8 t:RAMS64X1
|
| 37 |
+
select -assert-none t:FFRE t:RAMS64X1 %% t:* %D
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
design -reset
|
| 41 |
+
read_verilog ../common/lutram.v
|
| 42 |
+
hierarchy -top lutram_1w3r
|
| 43 |
+
proc
|
| 44 |
+
memory -nomap
|
| 45 |
+
equiv_opt -run :prove -map +/analogdevices/cells_sim.v synth_analogdevices -noiopad
|
| 46 |
+
memory
|
| 47 |
+
opt -full
|
| 48 |
+
|
| 49 |
+
miter -equiv -flatten -make_assert -make_outputs gold gate miter
|
| 50 |
+
sat -verify -prove-asserts -seq 3 -set-init-zero -show-inputs -show-outputs miter
|
| 51 |
+
|
| 52 |
+
design -load postopt
|
| 53 |
+
cd lutram_1w3r
|
| 54 |
+
select -assert-count 24 t:FFRE
|
| 55 |
+
select -assert-count 16 t:RAMD32X1
|
| 56 |
+
select -assert-none t:FFRE t:RAMD32X1 %% t:* %D
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
design -reset
|
| 60 |
+
read_verilog ../common/lutram.v
|
| 61 |
+
hierarchy -top lutram_1w3r -chparam A_WIDTH 6
|
| 62 |
+
proc
|
| 63 |
+
memory -nomap
|
| 64 |
+
equiv_opt -run :prove -map +/analogdevices/cells_sim.v synth_analogdevices -noiopad
|
| 65 |
+
memory
|
| 66 |
+
opt -full
|
| 67 |
+
|
| 68 |
+
miter -equiv -flatten -make_assert -make_outputs gold gate miter
|
| 69 |
+
sat -verify -prove-asserts -seq 3 -set-init-zero -show-inputs -show-outputs miter
|
| 70 |
+
|
| 71 |
+
design -load postopt
|
| 72 |
+
cd lutram_1w3r
|
| 73 |
+
select -assert-count 24 t:FFRE
|
| 74 |
+
select -assert-count 16 t:RAMD64X1
|
| 75 |
+
select -assert-none t:FFRE t:RAMD64X1 %% t:* %D
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
design -reset
|
| 79 |
+
read_verilog ../common/lutram.v
|
| 80 |
+
hierarchy -top lutram_1w1r -chparam A_WIDTH 5 -chparam D_WIDTH 6
|
| 81 |
+
proc
|
| 82 |
+
memory -nomap
|
| 83 |
+
equiv_opt -run :prove -map +/analogdevices/cells_sim.v synth_analogdevices -noiopad
|
| 84 |
+
memory
|
| 85 |
+
opt -full
|
| 86 |
+
|
| 87 |
+
miter -equiv -flatten -make_assert -make_outputs gold gate miter
|
| 88 |
+
sat -verify -prove-asserts -seq 3 -set-init-zero -show-inputs -show-outputs miter
|
| 89 |
+
|
| 90 |
+
design -load postopt
|
| 91 |
+
cd lutram_1w1r
|
| 92 |
+
select -assert-count 6 t:FFRE
|
| 93 |
+
select -assert-count 6 t:RAMS64X1
|
| 94 |
+
select -assert-none t:FFRE t:RAMS64X1 %% t:* %D
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
design -reset
|
| 98 |
+
read_verilog ../common/lutram.v
|
| 99 |
+
hierarchy -top lutram_1w1r -chparam A_WIDTH 6 -chparam D_WIDTH 6
|
| 100 |
+
proc
|
| 101 |
+
memory -nomap
|
| 102 |
+
equiv_opt -run :prove -map +/analogdevices/cells_sim.v synth_analogdevices -noiopad
|
| 103 |
+
memory
|
| 104 |
+
opt -full
|
| 105 |
+
|
| 106 |
+
miter -equiv -flatten -make_assert -make_outputs gold gate miter
|
| 107 |
+
sat -verify -prove-asserts -seq 3 -set-init-zero -show-inputs -show-outputs miter
|
| 108 |
+
|
| 109 |
+
design -load postopt
|
| 110 |
+
cd lutram_1w1r
|
| 111 |
+
select -assert-count 6 t:FFRE
|
| 112 |
+
select -assert-count 6 t:RAMS64X1
|
| 113 |
+
select -assert-none t:FFRE t:RAMS64X1 %% t:* %D
|
chips/yosys/tests/arch/analogdevices/mem_gen.py
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from dataclasses import dataclass
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
blockram_template = """# ======================================
|
| 7 |
+
log ** GENERATING TEST {top} WITH PARAMS{param_str}
|
| 8 |
+
design -reset; read_verilog -defer ../common/blockram.v
|
| 9 |
+
chparam{param_str} {top}
|
| 10 |
+
hierarchy -top {top}
|
| 11 |
+
echo on
|
| 12 |
+
debug synth_analogdevices -tech {tech} -top {top} {opts} -run :map_ffram
|
| 13 |
+
stat; echo off
|
| 14 |
+
"""
|
| 15 |
+
inference_tests: "list[tuple[str, list[tuple[str, int]], str, list[str], list[str]]]" = [
|
| 16 |
+
# RBRAM2 has TDP and SDP for 8192x5bit, 4096x9bit, and 2048x40bit
|
| 17 |
+
("t16ffc", [("ADDRESS_WIDTH", 13), ("DATA_WIDTH", 5)], "sync_ram_*dp", ["-assert-count 1 t:RBRAM2"], []),
|
| 18 |
+
("t16ffc", [("ADDRESS_WIDTH", 12), ("DATA_WIDTH", 9)], "sync_ram_*dp", ["-assert-count 1 t:RBRAM2"], []),
|
| 19 |
+
("t16ffc", [("ADDRESS_WIDTH", 11), ("DATA_WIDTH", 40)], "sync_ram_*dp", ["-assert-count 1 t:RBRAM2"], []),
|
| 20 |
+
# LUTRAM is generally cheaper than BRAM for undersized (SDP) memories
|
| 21 |
+
("t16ffc", [("ADDRESS_WIDTH", 6), ("DATA_WIDTH", 1)], "sync_ram_sdp", ["-assert-count 1 t:RAMD64X1"], []),
|
| 22 |
+
("t16ffc", [("ADDRESS_WIDTH", 6), ("DATA_WIDTH", 8)], "sync_ram_sdp", ["-assert-count 8 t:RAMD64X1"], []),
|
| 23 |
+
("t16ffc", [("ADDRESS_WIDTH", 10), ("DATA_WIDTH", 8)], "sync_ram_sdp", ["-assert-count 128 t:RAMD64X1"], []),
|
| 24 |
+
("t16ffc", [("ADDRESS_WIDTH", 10), ("DATA_WIDTH", 16)], "sync_ram_sdp", ["-assert-count 256 t:RAMD64X1"], []),
|
| 25 |
+
# RBRAM is half the depth of RBRAM2, and doesn't have TDP, also LUTRAM is cheaper, so we need to specify not to use it
|
| 26 |
+
("t40lp", [("ADDRESS_WIDTH", 13), ("DATA_WIDTH", 5)], "sync_ram_sdp", ["-assert-count 2 t:RBRAM"], ["-nolutram"]),
|
| 27 |
+
("t40lp", [("ADDRESS_WIDTH", 12), ("DATA_WIDTH", 5)], "sync_ram_sdp", ["-assert-count 1 t:RBRAM"], ["-nolutram"]),
|
| 28 |
+
("t40lp", [("ADDRESS_WIDTH", 11), ("DATA_WIDTH", 9)], "sync_ram_sdp", ["-assert-count 1 t:RBRAM"], ["-nolutram"]),
|
| 29 |
+
("t40lp", [("ADDRESS_WIDTH", 10), ("DATA_WIDTH", 40)], "sync_ram_sdp", ["-assert-count 1 t:RBRAM"], ["-nolutram"]),
|
| 30 |
+
# 2048x32 and 2048x36bit are also valid
|
| 31 |
+
("t16ffc", [("ADDRESS_WIDTH", 11), ("DATA_WIDTH", 32)], "sync_ram_*dp", ["-assert-count 1 t:RBRAM2"], []),
|
| 32 |
+
("t16ffc", [("ADDRESS_WIDTH", 11), ("DATA_WIDTH", 36)], "sync_ram_*dp", ["-assert-count 1 t:RBRAM2"], []),
|
| 33 |
+
("t40lp", [("ADDRESS_WIDTH", 10), ("DATA_WIDTH", 32)], "sync_ram_sdp", ["-assert-count 1 t:RBRAM"], ["-nolutram"]),
|
| 34 |
+
("t40lp", [("ADDRESS_WIDTH", 10), ("DATA_WIDTH", 36)], "sync_ram_sdp", ["-assert-count 1 t:RBRAM"], ["-nolutram"]),
|
| 35 |
+
|
| 36 |
+
# 4096x16/18bit can be mapped to a single 2048x32/36bit
|
| 37 |
+
("t16ffc", [("ADDRESS_WIDTH", 12), ("DATA_WIDTH", 16)], "sync_ram_*dp", ["-assert-count 1 t:RBRAM2"], []),
|
| 38 |
+
("t16ffc", [("ADDRESS_WIDTH", 12), ("DATA_WIDTH", 18)], "sync_ram_*dp", ["-assert-count 1 t:RBRAM2"], []),
|
| 39 |
+
("t40lp", [("ADDRESS_WIDTH", 11), ("DATA_WIDTH", 16)], "sync_ram_sdp", ["-assert-count 1 t:RBRAM"], ["-nolutram"]),
|
| 40 |
+
("t40lp", [("ADDRESS_WIDTH", 11), ("DATA_WIDTH", 18)], "sync_ram_sdp", ["-assert-count 1 t:RBRAM"], ["-nolutram"]),
|
| 41 |
+
# same for 8192x8/9bit
|
| 42 |
+
("t16ffc", [("ADDRESS_WIDTH", 13), ("DATA_WIDTH", 8)], "sync_ram_*dp", ["-assert-count 1 t:RBRAM2"], []),
|
| 43 |
+
("t16ffc", [("ADDRESS_WIDTH", 13), ("DATA_WIDTH", 9)], "sync_ram_*dp", ["-assert-count 1 t:RBRAM2"], []),
|
| 44 |
+
("t40lp", [("ADDRESS_WIDTH", 12), ("DATA_WIDTH", 8)], "sync_ram_sdp", ["-assert-count 1 t:RBRAM"], ["-nolutram"]),
|
| 45 |
+
("t40lp", [("ADDRESS_WIDTH", 12), ("DATA_WIDTH", 9)], "sync_ram_sdp", ["-assert-count 1 t:RBRAM"], ["-nolutram"]),
|
| 46 |
+
# but 4096x20bit requires extra memories because 2048x40bit has 8bit byte enables (which doesn't divide 20bit evenly)
|
| 47 |
+
("t16ffc", [("ADDRESS_WIDTH", 12), ("DATA_WIDTH", 20)], "sync_ram_sdp", ["-assert-count 2 t:RBRAM2"], []),
|
| 48 |
+
("t40lp", [("ADDRESS_WIDTH", 11), ("DATA_WIDTH", 20)], "sync_ram_sdp", ["-assert-count 2 t:RBRAM"], ["-nolutram"]),
|
| 49 |
+
]
|
| 50 |
+
|
| 51 |
+
@dataclass
|
| 52 |
+
class TestClass:
|
| 53 |
+
params: dict[str, int]
|
| 54 |
+
top: str
|
| 55 |
+
assertions: list[str]
|
| 56 |
+
test_steps: None | list[dict[str, int]]
|
| 57 |
+
opts: list[str]
|
| 58 |
+
tech: str = "t16ffc"
|
| 59 |
+
|
| 60 |
+
sim_tests: list[TestClass] = []
|
| 61 |
+
|
| 62 |
+
for (tech, params, top, assertions, opts) in inference_tests:
|
| 63 |
+
sim_test = TestClass(
|
| 64 |
+
params=dict(params),
|
| 65 |
+
top=top,
|
| 66 |
+
assertions=assertions,
|
| 67 |
+
test_steps=None,
|
| 68 |
+
opts=opts,
|
| 69 |
+
tech=tech,
|
| 70 |
+
)
|
| 71 |
+
sim_tests.append(sim_test)
|
| 72 |
+
|
| 73 |
+
i = 0
|
| 74 |
+
j = 0
|
| 75 |
+
max_j = 16
|
| 76 |
+
f = None
|
| 77 |
+
for sim_test in sim_tests:
|
| 78 |
+
# format params
|
| 79 |
+
param_str = ""
|
| 80 |
+
for (key, val) in sim_test.params.items():
|
| 81 |
+
param_str += f" -set {key} {val}"
|
| 82 |
+
|
| 83 |
+
# resolve top module wildcards
|
| 84 |
+
top_list = [sim_test.top]
|
| 85 |
+
if "*dp" in sim_test.top:
|
| 86 |
+
top_list += [
|
| 87 |
+
sim_test.top.replace("*dp", dp_sub) for dp_sub in ["sdp", "tdp"]
|
| 88 |
+
]
|
| 89 |
+
if "w*r" in sim_test.top:
|
| 90 |
+
top_list += [
|
| 91 |
+
sim_test.top.replace("w*r", wr_sub) for wr_sub in ["wwr", "wrr"]
|
| 92 |
+
]
|
| 93 |
+
if len(top_list) > 1:
|
| 94 |
+
top_list.pop(0)
|
| 95 |
+
|
| 96 |
+
# iterate over string substitutions
|
| 97 |
+
for top in top_list:
|
| 98 |
+
# limit number of tests per file to allow parallel make
|
| 99 |
+
if not f:
|
| 100 |
+
fn = f"t_mem{i}.ys"
|
| 101 |
+
f = open(fn, mode="w")
|
| 102 |
+
j = 0
|
| 103 |
+
|
| 104 |
+
# output yosys script test file
|
| 105 |
+
print(
|
| 106 |
+
blockram_template.format(param_str=param_str, top=top, tech=sim_test.tech, opts=" ".join(sim_test.opts)),
|
| 107 |
+
file=f
|
| 108 |
+
)
|
| 109 |
+
for assertion in sim_test.assertions:
|
| 110 |
+
print(f"log ** CHECKING CELL COUNTS FOR TEST {top} WITH PARAMS{param_str} ON TECH {sim_test.tech}", file=f)
|
| 111 |
+
print(f"select {assertion}", file=f)
|
| 112 |
+
print("", file=f)
|
| 113 |
+
|
| 114 |
+
# increment test counter
|
| 115 |
+
j += 1
|
| 116 |
+
if j >= max_j:
|
| 117 |
+
f = f.close()
|
| 118 |
+
i += 1
|
| 119 |
+
|
| 120 |
+
if f:
|
| 121 |
+
f.close()
|
chips/yosys/tests/arch/analogdevices/mul.ys
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog ../common/mul.v
|
| 2 |
+
hierarchy -top top
|
| 3 |
+
proc
|
| 4 |
+
equiv_opt -assert -map +/analogdevices/cells_sim.v synth_analogdevices -noiopad # equivalency check
|
| 5 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 6 |
+
cd top # Constrain all select calls below inside the top module
|
| 7 |
+
|
| 8 |
+
select -assert-count 1 t:RBBDSP
|
| 9 |
+
select -assert-none t:RBBDSP %% t:* %D
|
chips/yosys/tests/arch/analogdevices/mul_unsigned.v
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
Example from: https://www.xilinx.com/support/documentation/sw_manuals/xilinx2019_1/ug901-vivado-synthesis.pdf [p. 89].
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
// Unsigned 16x24-bit Multiplier
|
| 6 |
+
// 1 latency stage on operands
|
| 7 |
+
// 3 latency stage after the multiplication
|
| 8 |
+
// File: multipliers2.v
|
| 9 |
+
//
|
| 10 |
+
module mul_unsigned (clk, A, B, RES);
|
| 11 |
+
parameter WIDTHA = /*16*/ 6;
|
| 12 |
+
parameter WIDTHB = /*24*/ 9;
|
| 13 |
+
input clk;
|
| 14 |
+
input [WIDTHA-1:0] A;
|
| 15 |
+
input [WIDTHB-1:0] B;
|
| 16 |
+
output [WIDTHA+WIDTHB-1:0] RES;
|
| 17 |
+
reg [WIDTHA-1:0] rA;
|
| 18 |
+
reg [WIDTHB-1:0] rB;
|
| 19 |
+
reg [WIDTHA+WIDTHB-1:0] M [3:0];
|
| 20 |
+
integer i;
|
| 21 |
+
always @(posedge clk)
|
| 22 |
+
begin
|
| 23 |
+
rA <= A;
|
| 24 |
+
rB <= B;
|
| 25 |
+
M[0] <= rA * rB;
|
| 26 |
+
for (i = 0; i < 3; i = i+1)
|
| 27 |
+
M[i+1] <= M[i];
|
| 28 |
+
end
|
| 29 |
+
assign RES = M[3];
|
| 30 |
+
endmodule
|
chips/yosys/tests/arch/analogdevices/mul_unsigned.ys
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog mul_unsigned.v
|
| 2 |
+
hierarchy -top mul_unsigned
|
| 3 |
+
proc
|
| 4 |
+
|
| 5 |
+
equiv_opt -assert -map +/analogdevices/cells_sim.v synth_analogdevices -noiopad # equivalency check
|
| 6 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 7 |
+
cd mul_unsigned # Constrain all select calls below inside the top module
|
| 8 |
+
select -assert-count 1 t:RBBDSP
|
| 9 |
+
select -assert-count 75 t:FFRE
|
| 10 |
+
select -assert-none t:RBBDSP t:FFRE %% t:* %D
|
chips/yosys/tests/arch/analogdevices/mux.ys
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog ../common/mux.v
|
| 2 |
+
design -save read
|
| 3 |
+
|
| 4 |
+
hierarchy -top mux2
|
| 5 |
+
proc
|
| 6 |
+
equiv_opt -assert -map +/analogdevices/cells_sim.v synth_analogdevices -noiopad # equivalency check
|
| 7 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 8 |
+
cd mux2 # Constrain all select calls below inside the top module
|
| 9 |
+
select -assert-count 1 t:LUT3
|
| 10 |
+
|
| 11 |
+
select -assert-none t:LUT3 %% t:* %D
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
design -load read
|
| 15 |
+
hierarchy -top mux4
|
| 16 |
+
proc
|
| 17 |
+
equiv_opt -assert -map +/analogdevices/cells_sim.v synth_analogdevices -noiopad # equivalency check
|
| 18 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 19 |
+
cd mux4 # Constrain all select calls below inside the top module
|
| 20 |
+
select -assert-count 1 t:LUT6
|
| 21 |
+
|
| 22 |
+
select -assert-none t:LUT6 %% t:* %D
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
design -load read
|
| 26 |
+
hierarchy -top mux8
|
| 27 |
+
proc
|
| 28 |
+
equiv_opt -assert -map +/analogdevices/cells_sim.v synth_analogdevices -noiopad # equivalency check
|
| 29 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 30 |
+
cd mux8 # Constrain all select calls below inside the top module
|
| 31 |
+
select -assert-count 1 t:LUT3
|
| 32 |
+
select -assert-count 2 t:LUT6
|
| 33 |
+
|
| 34 |
+
select -assert-none t:LUT3 t:LUT6 %% t:* %D
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
design -load read
|
| 38 |
+
hierarchy -top mux16
|
| 39 |
+
proc
|
| 40 |
+
equiv_opt -assert -map +/analogdevices/cells_sim.v synth_analogdevices -noiopad # equivalency check
|
| 41 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 42 |
+
cd mux16 # Constrain all select calls below inside the top module
|
| 43 |
+
select -assert-max 2 t:LUT3
|
| 44 |
+
select -assert-max 2 t:LUT4
|
| 45 |
+
select -assert-min 4 t:LUT6
|
| 46 |
+
select -assert-max 7 t:LUT6
|
| 47 |
+
select -assert-max 2 t:LUTMUX7
|
| 48 |
+
dump
|
| 49 |
+
|
| 50 |
+
select -assert-none t:LUT6 t:LUT4 t:LUT3 t:LUTMUX7 %% t:* %D
|
chips/yosys/tests/arch/analogdevices/opt_lut_ins.ys
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_rtlil << EOF
|
| 2 |
+
|
| 3 |
+
module \top
|
| 4 |
+
|
| 5 |
+
wire width 4 input 1 \A
|
| 6 |
+
|
| 7 |
+
wire output 2 \O
|
| 8 |
+
|
| 9 |
+
cell \LUT4 $0
|
| 10 |
+
parameter \INIT 16'1111110011000000
|
| 11 |
+
connect \I0 \A [0]
|
| 12 |
+
connect \I1 \A [1]
|
| 13 |
+
connect \I2 \A [2]
|
| 14 |
+
connect \I3 \A [3]
|
| 15 |
+
connect \O \O
|
| 16 |
+
end
|
| 17 |
+
end
|
| 18 |
+
|
| 19 |
+
EOF
|
| 20 |
+
|
| 21 |
+
read_verilog -lib +/analogdevices/cells_sim.v
|
| 22 |
+
equiv_opt -assert -map +/analogdevices/cells_sim.v opt_lut_ins -tech analogdevices
|
| 23 |
+
|
| 24 |
+
design -load postopt
|
| 25 |
+
|
| 26 |
+
select -assert-count 1 t:LUT3
|
chips/yosys/tests/arch/analogdevices/shifter.ys
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog ../common/shifter.v
|
| 2 |
+
hierarchy -top top
|
| 3 |
+
proc
|
| 4 |
+
flatten
|
| 5 |
+
equiv_opt -assert -map +/analogdevices/cells_sim.v synth_analogdevices -noiopad # equivalency check
|
| 6 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 7 |
+
cd top # Constrain all select calls below inside the top module
|
| 8 |
+
|
| 9 |
+
select -assert-count 8 t:FFRE
|
| 10 |
+
select -assert-none t:FFRE %% t:* %D
|
chips/yosys/tests/arch/anlogic/.gitignore
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
+*_synth.v
|
| 2 |
+
+*_testbench
|
chips/yosys/tests/arch/anlogic/add_sub.ys
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog ../common/add_sub.v
|
| 2 |
+
hierarchy -top top
|
| 3 |
+
proc
|
| 4 |
+
equiv_opt -assert -map +/anlogic/cells_sim.v synth_anlogic # equivalency check
|
| 5 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 6 |
+
cd top # Constrain all select calls below inside the top module
|
| 7 |
+
select -assert-count 10 t:AL_MAP_ADDER
|
| 8 |
+
select -assert-count 4 t:AL_MAP_LUT1
|
| 9 |
+
|
| 10 |
+
select -assert-none t:AL_MAP_LUT1 t:AL_MAP_ADDER %% t:* %D
|
chips/yosys/tests/arch/anlogic/blockram.ys
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog ../common/blockram.v
|
| 2 |
+
hierarchy -top sync_ram_sp
|
| 3 |
+
proc
|
| 4 |
+
memory -nomap
|
| 5 |
+
equiv_opt -run :prove -map +/anlogic/cells_sim.v synth_anlogic
|
| 6 |
+
memory
|
| 7 |
+
opt -full
|
| 8 |
+
|
| 9 |
+
design -load postopt
|
| 10 |
+
cd sync_ram_sp
|
| 11 |
+
|
| 12 |
+
select -assert-count 1 t:EG_PHY_BRAM
|
| 13 |
+
select -assert-none t:EG_PHY_BRAM %% t:* %D
|
chips/yosys/tests/arch/anlogic/counter.ys
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog ../common/counter.v
|
| 2 |
+
hierarchy -top top
|
| 3 |
+
proc
|
| 4 |
+
flatten
|
| 5 |
+
equiv_opt -assert -multiclock -map +/anlogic/cells_sim.v synth_anlogic # equivalency check
|
| 6 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 7 |
+
cd top # Constrain all select calls below inside the top module
|
| 8 |
+
|
| 9 |
+
select -assert-count 9 t:AL_MAP_ADDER
|
| 10 |
+
select -assert-count 8 t:AL_MAP_SEQ
|
| 11 |
+
select -assert-none t:AL_MAP_SEQ t:AL_MAP_ADDER %% t:* %D
|
chips/yosys/tests/arch/anlogic/dffs.ys
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog ../common/dffs.v
|
| 2 |
+
design -save read
|
| 3 |
+
|
| 4 |
+
hierarchy -top dff
|
| 5 |
+
proc
|
| 6 |
+
equiv_opt -assert -map +/anlogic/cells_sim.v synth_anlogic # equivalency check
|
| 7 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 8 |
+
cd dff # Constrain all select calls below inside the top module
|
| 9 |
+
select -assert-count 1 t:AL_MAP_SEQ
|
| 10 |
+
select -assert-none t:AL_MAP_SEQ %% t:* %D
|
| 11 |
+
|
| 12 |
+
design -load read
|
| 13 |
+
hierarchy -top dffe
|
| 14 |
+
proc
|
| 15 |
+
equiv_opt -assert -map +/anlogic/cells_sim.v synth_anlogic # equivalency check
|
| 16 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 17 |
+
cd dffe # Constrain all select calls below inside the top module
|
| 18 |
+
select -assert-count 1 t:AL_MAP_SEQ
|
| 19 |
+
select -assert-none t:AL_MAP_SEQ %% t:* %D
|
chips/yosys/tests/arch/anlogic/fsm.ys
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog ../common/fsm.v
|
| 2 |
+
hierarchy -top fsm
|
| 3 |
+
proc
|
| 4 |
+
flatten
|
| 5 |
+
|
| 6 |
+
equiv_opt -run :prove -map +/anlogic/cells_sim.v synth_anlogic
|
| 7 |
+
miter -equiv -make_assert -flatten gold gate miter
|
| 8 |
+
sat -verify -prove-asserts -show-public -set-at 1 in_reset 1 -seq 20 -prove-skip 1 miter
|
| 9 |
+
|
| 10 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 11 |
+
cd fsm # Constrain all select calls below inside the top module
|
| 12 |
+
|
| 13 |
+
select -assert-count 6 t:AL_MAP_SEQ
|
| 14 |
+
|
| 15 |
+
select -assert-none t:AL_MAP_LUT* t:AL_MAP_SEQ %% t:* %D
|
chips/yosys/tests/arch/anlogic/generate_mk.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
|
| 3 |
+
import sys
|
| 4 |
+
sys.path.append("../..")
|
| 5 |
+
|
| 6 |
+
import gen_tests_makefile
|
| 7 |
+
|
| 8 |
+
gen_tests_makefile.generate(["--yosys-scripts", "--bash", "--yosys-args", "-w 'Yosys has only limited support for tri-state logic at the moment.'" ])
|
chips/yosys/tests/arch/anlogic/latches.ys
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog ../common/latches.v
|
| 2 |
+
design -save read
|
| 3 |
+
|
| 4 |
+
hierarchy -top latchp
|
| 5 |
+
proc
|
| 6 |
+
equiv_opt -assert -multiclock -map +/anlogic/cells_sim.v synth_anlogic
|
| 7 |
+
design -load postopt
|
| 8 |
+
cd latchp # Constrain all select calls below inside the top module
|
| 9 |
+
|
| 10 |
+
select -assert-count 1 t:AL_MAP_SEQ
|
| 11 |
+
select -assert-count 1 t:AL_MAP_LUT1
|
| 12 |
+
select -assert-none t:AL_MAP_SEQ t:AL_MAP_LUT1 %% t:* %D
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
design -load read
|
| 16 |
+
hierarchy -top latchn
|
| 17 |
+
proc
|
| 18 |
+
equiv_opt -assert -multiclock -map +/anlogic/cells_sim.v synth_anlogic
|
| 19 |
+
design -load postopt
|
| 20 |
+
cd latchn # Constrain all select calls below inside the top module
|
| 21 |
+
|
| 22 |
+
select -assert-count 1 t:AL_MAP_SEQ
|
| 23 |
+
select -assert-none t:AL_MAP_SEQ %% t:* %D
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
design -load read
|
| 27 |
+
hierarchy -top latchsr
|
| 28 |
+
proc
|
| 29 |
+
equiv_opt -assert -multiclock -map +/anlogic/cells_sim.v synth_anlogic
|
| 30 |
+
design -load postopt
|
| 31 |
+
cd latchsr # Constrain all select calls below inside the top module
|
| 32 |
+
|
| 33 |
+
select -assert-count 1 t:AL_MAP_SEQ
|
| 34 |
+
select -assert-count 2 t:AL_MAP_LUT3
|
| 35 |
+
select -assert-none t:AL_MAP_SEQ t:AL_MAP_LUT3 %% t:* %D
|
chips/yosys/tests/arch/anlogic/logic.ys
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog ../common/logic.v
|
| 2 |
+
hierarchy -top top
|
| 3 |
+
proc
|
| 4 |
+
equiv_opt -assert -map +/anlogic/cells_sim.v synth_anlogic # equivalency check
|
| 5 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 6 |
+
cd top # Constrain all select calls below inside the top module
|
| 7 |
+
|
| 8 |
+
select -assert-count 4 t:AL_MAP_LUT1
|
| 9 |
+
select -assert-count 3 t:AL_MAP_LUT2
|
| 10 |
+
select -assert-count 2 t:AL_MAP_LUT4
|
| 11 |
+
select -assert-none t:AL_MAP_LUT1 t:AL_MAP_LUT2 t:AL_MAP_LUT4 %% t:* %D
|
chips/yosys/tests/arch/anlogic/lutram.ys
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog ../common/lutram.v
|
| 2 |
+
hierarchy -top lutram_1w1r
|
| 3 |
+
proc
|
| 4 |
+
memory -nomap
|
| 5 |
+
equiv_opt -run :prove -map +/anlogic/cells_sim.v synth_anlogic -nobram
|
| 6 |
+
memory
|
| 7 |
+
opt -full
|
| 8 |
+
|
| 9 |
+
miter -equiv -flatten -make_assert -make_outputs gold gate miter
|
| 10 |
+
#ERROR: Failed to import cell gate.mem.0.0.0 (type EG_LOGIC_DRAM16X4) to SAT database.
|
| 11 |
+
#sat -verify -prove-asserts -seq 3 -set-init-zero -show-inputs -show-outputs miter
|
| 12 |
+
|
| 13 |
+
design -load postopt
|
| 14 |
+
cd lutram_1w1r
|
| 15 |
+
|
| 16 |
+
select -assert-count 4 t:AL_MAP_LUT3
|
| 17 |
+
select -assert-count 8 t:AL_MAP_LUT6
|
| 18 |
+
select -assert-count 8 t:AL_MAP_SEQ
|
| 19 |
+
select -assert-count 8 t:EG_LOGIC_DRAM16X4 #Why not AL_LOGIC_BRAM?
|
| 20 |
+
select -assert-none t:AL_MAP_LUT3 t:AL_MAP_LUT6 t:AL_MAP_SEQ t:EG_LOGIC_DRAM16X4 %% t:* %D
|
chips/yosys/tests/arch/anlogic/mux.ys
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog ../common/mux.v
|
| 2 |
+
design -save read
|
| 3 |
+
|
| 4 |
+
hierarchy -top mux2
|
| 5 |
+
proc
|
| 6 |
+
equiv_opt -assert -map +/anlogic/cells_sim.v synth_anlogic # equivalency check
|
| 7 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 8 |
+
cd mux2 # Constrain all select calls below inside the top module
|
| 9 |
+
select -assert-count 1 t:AL_MAP_LUT3
|
| 10 |
+
|
| 11 |
+
select -assert-none t:AL_MAP_LUT3 %% t:* %D
|
| 12 |
+
|
| 13 |
+
design -load read
|
| 14 |
+
hierarchy -top mux4
|
| 15 |
+
proc
|
| 16 |
+
equiv_opt -assert -map +/anlogic/cells_sim.v synth_anlogic # equivalency check
|
| 17 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 18 |
+
cd mux4 # Constrain all select calls below inside the top module
|
| 19 |
+
select -assert-count 1 t:AL_MAP_LUT6
|
| 20 |
+
|
| 21 |
+
select -assert-none t:AL_MAP_LUT6 %% t:* %D
|
| 22 |
+
|
| 23 |
+
design -load read
|
| 24 |
+
hierarchy -top mux8
|
| 25 |
+
proc
|
| 26 |
+
equiv_opt -assert -map +/anlogic/cells_sim.v synth_anlogic # equivalency check
|
| 27 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 28 |
+
cd mux8 # Constrain all select calls below inside the top module
|
| 29 |
+
select -assert-max 4 t:AL_MAP_LUT4
|
| 30 |
+
select -assert-max 1 t:AL_MAP_LUT5
|
| 31 |
+
|
| 32 |
+
select -assert-none t:AL_MAP_LUT4 t:AL_MAP_LUT5 %% t:* %D
|
| 33 |
+
|
| 34 |
+
design -load read
|
| 35 |
+
hierarchy -top mux16
|
| 36 |
+
proc
|
| 37 |
+
|
| 38 |
+
# Flaky test, started failing with statically allocated IdStrings, but works
|
| 39 |
+
# for me locally when I scramble the names using:
|
| 40 |
+
#
|
| 41 |
+
# rename -scramble-name -seed 1
|
| 42 |
+
#
|
| 43 |
+
|
| 44 |
+
#equiv_opt -assert -map +/anlogic/cells_sim.v synth_anlogic # equivalency check
|
| 45 |
+
#design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 46 |
+
#cd mux16 # Constrain all select calls below inside the top module
|
| 47 |
+
#show
|
| 48 |
+
#select -assert-count 5 t:AL_MAP_LUT6
|
| 49 |
+
|
| 50 |
+
#select -assert-none t:AL_MAP_LUT6 %% t:* %D
|
chips/yosys/tests/arch/anlogic/shifter.ys
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog ../common/shifter.v
|
| 2 |
+
hierarchy -top top
|
| 3 |
+
proc
|
| 4 |
+
flatten
|
| 5 |
+
equiv_opt -assert -map +/anlogic/cells_sim.v synth_anlogic # equivalency check
|
| 6 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 7 |
+
cd top # Constrain all select calls below inside the top module
|
| 8 |
+
select -assert-count 8 t:AL_MAP_SEQ
|
| 9 |
+
|
| 10 |
+
select -assert-none t:AL_MAP_SEQ %% t:* %D
|
chips/yosys/tests/arch/anlogic/tribuf.ys
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog ../common/tribuf.v
|
| 2 |
+
hierarchy -top tristate
|
| 3 |
+
proc
|
| 4 |
+
flatten
|
| 5 |
+
equiv_opt -assert -map +/anlogic/cells_sim.v -map +/simcells.v synth_anlogic # equivalency check
|
| 6 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 7 |
+
cd tristate # Constrain all select calls below inside the top module
|
| 8 |
+
select -assert-count 1 t:$_TBUF_
|
| 9 |
+
select -assert-none t:$_TBUF_ %% t:* %D
|
chips/yosys/tests/arch/common/add_sub.v
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module top
|
| 2 |
+
(
|
| 3 |
+
input [3:0] x,
|
| 4 |
+
input [3:0] y,
|
| 5 |
+
|
| 6 |
+
output [3:0] A,
|
| 7 |
+
output [3:0] B
|
| 8 |
+
);
|
| 9 |
+
|
| 10 |
+
assign A = x + y;
|
| 11 |
+
assign B = x - y;
|
| 12 |
+
endmodule
|
chips/yosys/tests/arch/common/adffs.v
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module adff( input d, clk, clr, output reg q );
|
| 2 |
+
`ifndef NO_INIT
|
| 3 |
+
initial begin
|
| 4 |
+
q = 0;
|
| 5 |
+
end
|
| 6 |
+
`endif
|
| 7 |
+
always @( posedge clk, posedge clr )
|
| 8 |
+
if ( clr )
|
| 9 |
+
q <= 1'b0;
|
| 10 |
+
else
|
| 11 |
+
q <= d;
|
| 12 |
+
endmodule
|
| 13 |
+
|
| 14 |
+
module adffn( input d, clk, clr, output reg q );
|
| 15 |
+
`ifndef NO_INIT
|
| 16 |
+
initial begin
|
| 17 |
+
q = 0;
|
| 18 |
+
end
|
| 19 |
+
`endif
|
| 20 |
+
always @( posedge clk, negedge clr )
|
| 21 |
+
if ( !clr )
|
| 22 |
+
q <= 1'b0;
|
| 23 |
+
else
|
| 24 |
+
q <= d;
|
| 25 |
+
endmodule
|
| 26 |
+
|
| 27 |
+
module dffs( input d, clk, pre, clr, output reg q );
|
| 28 |
+
`ifndef NO_INIT
|
| 29 |
+
initial begin
|
| 30 |
+
q = 0;
|
| 31 |
+
end
|
| 32 |
+
`endif
|
| 33 |
+
always @( posedge clk )
|
| 34 |
+
if ( pre )
|
| 35 |
+
q <= 1'b1;
|
| 36 |
+
else
|
| 37 |
+
q <= d;
|
| 38 |
+
endmodule
|
| 39 |
+
|
| 40 |
+
module ndffnr( input d, clk, pre, clr, output reg q );
|
| 41 |
+
`ifndef NO_INIT
|
| 42 |
+
initial begin
|
| 43 |
+
q = 0;
|
| 44 |
+
end
|
| 45 |
+
`endif
|
| 46 |
+
always @( negedge clk )
|
| 47 |
+
if ( !clr )
|
| 48 |
+
q <= 1'b0;
|
| 49 |
+
else
|
| 50 |
+
q <= d;
|
| 51 |
+
endmodule
|
chips/yosys/tests/arch/common/blockram.v
ADDED
|
@@ -0,0 +1,327 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`default_nettype none
|
| 2 |
+
module sync_ram_sp #(parameter DATA_WIDTH=8, ADDRESS_WIDTH=10)
|
| 3 |
+
(input wire write_enable, clk,
|
| 4 |
+
input wire [DATA_WIDTH-1:0] data_in,
|
| 5 |
+
input wire [ADDRESS_WIDTH-1:0] address_in,
|
| 6 |
+
output wire [DATA_WIDTH-1:0] data_out);
|
| 7 |
+
|
| 8 |
+
localparam WORD = (DATA_WIDTH-1);
|
| 9 |
+
localparam DEPTH = (2**ADDRESS_WIDTH-1);
|
| 10 |
+
|
| 11 |
+
reg [WORD:0] data_out_r;
|
| 12 |
+
reg [WORD:0] memory [0:DEPTH];
|
| 13 |
+
|
| 14 |
+
always @(posedge clk) begin
|
| 15 |
+
if (write_enable)
|
| 16 |
+
memory[address_in] <= data_in;
|
| 17 |
+
data_out_r <= memory[address_in];
|
| 18 |
+
end
|
| 19 |
+
|
| 20 |
+
assign data_out = data_out_r;
|
| 21 |
+
|
| 22 |
+
endmodule // sync_ram_sp
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
module sync_ram_sp_nochange #(parameter DATA_WIDTH=8, ADDRESS_WIDTH=10)
|
| 26 |
+
(input wire write_enable, clk,
|
| 27 |
+
input wire [DATA_WIDTH-1:0] data_in,
|
| 28 |
+
input wire [ADDRESS_WIDTH-1:0] address_in,
|
| 29 |
+
output wire [DATA_WIDTH-1:0] data_out);
|
| 30 |
+
|
| 31 |
+
localparam WORD = (DATA_WIDTH-1);
|
| 32 |
+
localparam DEPTH = (2**ADDRESS_WIDTH-1);
|
| 33 |
+
|
| 34 |
+
reg [WORD:0] data_out_r;
|
| 35 |
+
reg [WORD:0] memory [0:DEPTH];
|
| 36 |
+
|
| 37 |
+
always @(posedge clk) begin
|
| 38 |
+
if (write_enable)
|
| 39 |
+
memory[address_in] <= data_in;
|
| 40 |
+
else
|
| 41 |
+
data_out_r <= memory[address_in];
|
| 42 |
+
end
|
| 43 |
+
|
| 44 |
+
assign data_out = data_out_r;
|
| 45 |
+
|
| 46 |
+
endmodule // sync_ram_sp_nochange
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
module sync_ram_sdp #(parameter DATA_WIDTH=8, ADDRESS_WIDTH=10)
|
| 50 |
+
(input wire clk, write_enable,
|
| 51 |
+
input wire [DATA_WIDTH-1:0] data_in,
|
| 52 |
+
input wire [ADDRESS_WIDTH-1:0] address_in_r, address_in_w,
|
| 53 |
+
output wire [DATA_WIDTH-1:0] data_out);
|
| 54 |
+
|
| 55 |
+
localparam WORD = (DATA_WIDTH-1);
|
| 56 |
+
localparam DEPTH = (2**ADDRESS_WIDTH-1);
|
| 57 |
+
|
| 58 |
+
reg [WORD:0] data_out_r;
|
| 59 |
+
reg [WORD:0] memory [0:DEPTH];
|
| 60 |
+
|
| 61 |
+
always @(posedge clk) begin
|
| 62 |
+
if (write_enable)
|
| 63 |
+
memory[address_in_w] <= data_in;
|
| 64 |
+
data_out_r <= memory[address_in_r];
|
| 65 |
+
end
|
| 66 |
+
|
| 67 |
+
assign data_out = data_out_r;
|
| 68 |
+
|
| 69 |
+
endmodule // sync_ram_sdp
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
module sync_ram_sdp_wwr #(parameter DATA_WIDTH=8, ADDRESS_WIDTH=10, SHIFT_VAL=1) // wd=16, wa=9
|
| 73 |
+
(
|
| 74 |
+
input wire clk_w, clk_r, write_enable,
|
| 75 |
+
input wire [WORD-1:0] data_in,
|
| 76 |
+
input wire [ADDRESS_WIDTH_W-1:0] address_in_w,
|
| 77 |
+
input wire [ADDRESS_WIDTH-1:0] address_in_r,
|
| 78 |
+
output wire [DATA_WIDTH-1:0] data_out
|
| 79 |
+
);
|
| 80 |
+
|
| 81 |
+
localparam ADDRESS_WIDTH_W = ADDRESS_WIDTH-SHIFT_VAL;
|
| 82 |
+
localparam BYTE = DATA_WIDTH;
|
| 83 |
+
localparam WORD = DATA_WIDTH<<SHIFT_VAL;
|
| 84 |
+
localparam DEPTH = 2**ADDRESS_WIDTH_W;
|
| 85 |
+
localparam SUB_DEPTH = 2**SHIFT_VAL;
|
| 86 |
+
|
| 87 |
+
reg [BYTE-1:0] data_out_r;
|
| 88 |
+
reg [BYTE-1:0] memory [0:DEPTH-1];
|
| 89 |
+
|
| 90 |
+
integer i;
|
| 91 |
+
always @(posedge clk_w) begin
|
| 92 |
+
for (i=0; i<SUB_DEPTH; i=i+1)
|
| 93 |
+
if (write_enable)
|
| 94 |
+
memory[{address_in_w, i}] <= data_in[i*BYTE+:BYTE];
|
| 95 |
+
end
|
| 96 |
+
|
| 97 |
+
always @(posedge clk_r) begin
|
| 98 |
+
data_out_r <= memory[address_in_r];
|
| 99 |
+
end
|
| 100 |
+
|
| 101 |
+
assign data_out = data_out_r;
|
| 102 |
+
|
| 103 |
+
endmodule // sync_ram_sdp_wwr
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
module sync_ram_sdp_wrr #(parameter DATA_WIDTH=8, ADDRESS_WIDTH=10, SHIFT_VAL=1) // rd=16, ra=9
|
| 107 |
+
(
|
| 108 |
+
input wire clk_w, clk_r, write_enable,
|
| 109 |
+
input wire [DATA_WIDTH-1:0] data_in,
|
| 110 |
+
input wire [ADDRESS_WIDTH-1:0] address_in_w,
|
| 111 |
+
input wire [ADDRESS_WIDTH_R-1:0] address_in_r,
|
| 112 |
+
output wire [WORD-1:0] data_out
|
| 113 |
+
);
|
| 114 |
+
localparam ADDRESS_WIDTH_R = ADDRESS_WIDTH-SHIFT_VAL;
|
| 115 |
+
localparam BYTE = DATA_WIDTH;
|
| 116 |
+
localparam WORD = BYTE<<SHIFT_VAL;
|
| 117 |
+
localparam DEPTH = 2**ADDRESS_WIDTH;
|
| 118 |
+
localparam SUB_DEPTH = 2**SHIFT_VAL;
|
| 119 |
+
|
| 120 |
+
reg [WORD-1:0] data_out_r;
|
| 121 |
+
reg [BYTE-1:0] memory [0:DEPTH-1];
|
| 122 |
+
|
| 123 |
+
always @(posedge clk_w) begin
|
| 124 |
+
if (write_enable)
|
| 125 |
+
memory[address_in_w] <= data_in;
|
| 126 |
+
end
|
| 127 |
+
|
| 128 |
+
integer i;
|
| 129 |
+
always @(posedge clk_r) begin
|
| 130 |
+
for (i=0; i<SUB_DEPTH; i=i+1)
|
| 131 |
+
data_out_r[i*BYTE+:BYTE] <= memory[{address_in_r, i}];
|
| 132 |
+
end
|
| 133 |
+
|
| 134 |
+
assign data_out = data_out_r;
|
| 135 |
+
|
| 136 |
+
endmodule // sync_ram_sdp_wrr
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
module double_sync_ram_sp #(parameter DATA_WIDTH=8, ADDRESS_WIDTH=10, USE_TDP=0)
|
| 140 |
+
(
|
| 141 |
+
input wire write_enable_a, clk_a,
|
| 142 |
+
input wire [DATA_WIDTH-1:0] data_in_a,
|
| 143 |
+
input wire [ADDRESS_WIDTH-1:0] address_in_a,
|
| 144 |
+
output wire [DATA_WIDTH-1:0] data_out_a,
|
| 145 |
+
|
| 146 |
+
input wire write_enable_b, clk_b,
|
| 147 |
+
input wire [DATA_WIDTH-1:0] data_in_b,
|
| 148 |
+
input wire [ADDRESS_WIDTH-1:0] address_in_b,
|
| 149 |
+
output wire [DATA_WIDTH-1:0] data_out_b
|
| 150 |
+
);
|
| 151 |
+
|
| 152 |
+
generate
|
| 153 |
+
if (USE_TDP) begin
|
| 154 |
+
|
| 155 |
+
sync_ram_tdp #(
|
| 156 |
+
.DATA_WIDTH(DATA_WIDTH),
|
| 157 |
+
.ADDRESS_WIDTH(ADDRESS_WIDTH+1)
|
| 158 |
+
) ram (
|
| 159 |
+
.clk_a(clk_a), .clk_b(clk_b),
|
| 160 |
+
.write_enable_a(write_enable_a), .write_enable_b(write_enable_b),
|
| 161 |
+
.write_data_a(data_in_a), .write_data_b(data_in_b),
|
| 162 |
+
.addr_a({1'b0, address_in_a}), .addr_b({1'b1, address_in_b}),
|
| 163 |
+
.read_data_a(data_out_a), .read_data_b(data_out_b)
|
| 164 |
+
);
|
| 165 |
+
|
| 166 |
+
end else begin
|
| 167 |
+
|
| 168 |
+
sync_ram_sp #(
|
| 169 |
+
.DATA_WIDTH(DATA_WIDTH),
|
| 170 |
+
.ADDRESS_WIDTH(ADDRESS_WIDTH)
|
| 171 |
+
) a_ram (
|
| 172 |
+
.write_enable(write_enable_a),
|
| 173 |
+
.clk(clk_a),
|
| 174 |
+
.data_in(data_in_a),
|
| 175 |
+
.address_in(address_in_a),
|
| 176 |
+
.data_out(data_out_a)
|
| 177 |
+
);
|
| 178 |
+
|
| 179 |
+
sync_ram_sp #(
|
| 180 |
+
.DATA_WIDTH(DATA_WIDTH),
|
| 181 |
+
.ADDRESS_WIDTH(ADDRESS_WIDTH)
|
| 182 |
+
) b_ram (
|
| 183 |
+
.write_enable(write_enable_b),
|
| 184 |
+
.clk(clk_b),
|
| 185 |
+
.data_in(data_in_b),
|
| 186 |
+
.address_in(address_in_b),
|
| 187 |
+
.data_out(data_out_b)
|
| 188 |
+
);
|
| 189 |
+
end
|
| 190 |
+
endgenerate
|
| 191 |
+
|
| 192 |
+
endmodule // double_sync_ram_sp
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
module double_sync_ram_sdp #(parameter DATA_WIDTH_A=8, ADDRESS_WIDTH_A=10, DATA_WIDTH_B=8, ADDRESS_WIDTH_B=10)
|
| 196 |
+
(
|
| 197 |
+
input wire write_enable_a, clk_a,
|
| 198 |
+
input wire [DATA_WIDTH_A-1:0] data_in_a,
|
| 199 |
+
input wire [ADDRESS_WIDTH_A-1:0] address_in_r_a, address_in_w_a,
|
| 200 |
+
output wire [DATA_WIDTH_A-1:0] data_out_a,
|
| 201 |
+
|
| 202 |
+
input wire write_enable_b, clk_b,
|
| 203 |
+
input wire [DATA_WIDTH_B-1:0] data_in_b,
|
| 204 |
+
input wire [ADDRESS_WIDTH_B-1:0] address_in_r_b, address_in_w_b,
|
| 205 |
+
output wire [DATA_WIDTH_B-1:0] data_out_b
|
| 206 |
+
);
|
| 207 |
+
|
| 208 |
+
sync_ram_sdp #(
|
| 209 |
+
.DATA_WIDTH(DATA_WIDTH_A),
|
| 210 |
+
.ADDRESS_WIDTH(ADDRESS_WIDTH_A)
|
| 211 |
+
) a_ram (
|
| 212 |
+
.write_enable(write_enable_a),
|
| 213 |
+
.clk(clk_a),
|
| 214 |
+
.data_in(data_in_a),
|
| 215 |
+
.address_in_r(address_in_r_a),
|
| 216 |
+
.address_in_w(address_in_w_a),
|
| 217 |
+
.data_out(data_out_a)
|
| 218 |
+
);
|
| 219 |
+
|
| 220 |
+
sync_ram_sdp #(
|
| 221 |
+
.DATA_WIDTH(DATA_WIDTH_B),
|
| 222 |
+
.ADDRESS_WIDTH(ADDRESS_WIDTH_B)
|
| 223 |
+
) b_ram (
|
| 224 |
+
.write_enable(write_enable_b),
|
| 225 |
+
.clk(clk_b),
|
| 226 |
+
.data_in(data_in_b),
|
| 227 |
+
.address_in_r(address_in_r_b),
|
| 228 |
+
.address_in_w(address_in_w_b),
|
| 229 |
+
.data_out(data_out_b)
|
| 230 |
+
);
|
| 231 |
+
|
| 232 |
+
endmodule // double_sync_ram_sdp
|
| 233 |
+
|
| 234 |
+
|
| 235 |
+
module sync_ram_tdp #(parameter DATA_WIDTH=8, ADDRESS_WIDTH=10)
|
| 236 |
+
(input wire clk_a, clk_b,
|
| 237 |
+
input wire write_enable_a, write_enable_b,
|
| 238 |
+
input wire read_enable_a, read_enable_b,
|
| 239 |
+
input wire [DATA_WIDTH-1:0] write_data_a, write_data_b,
|
| 240 |
+
input wire [ADDRESS_WIDTH-1:0] addr_a, addr_b,
|
| 241 |
+
output reg [DATA_WIDTH-1:0] read_data_a, read_data_b);
|
| 242 |
+
|
| 243 |
+
localparam WORD = (DATA_WIDTH-1);
|
| 244 |
+
localparam DEPTH = (2**ADDRESS_WIDTH-1);
|
| 245 |
+
|
| 246 |
+
reg [WORD:0] mem [0:DEPTH];
|
| 247 |
+
|
| 248 |
+
always @(posedge clk_a) begin
|
| 249 |
+
if (write_enable_a)
|
| 250 |
+
mem[addr_a] <= write_data_a;
|
| 251 |
+
else
|
| 252 |
+
read_data_a <= mem[addr_a];
|
| 253 |
+
end
|
| 254 |
+
|
| 255 |
+
always @(posedge clk_b) begin
|
| 256 |
+
if (write_enable_b)
|
| 257 |
+
mem[addr_b] <= write_data_b;
|
| 258 |
+
else
|
| 259 |
+
read_data_b <= mem[addr_b];
|
| 260 |
+
end
|
| 261 |
+
|
| 262 |
+
endmodule // sync_ram_tdp
|
| 263 |
+
|
| 264 |
+
module double_sync_ram_tdp #(parameter DATA_WIDTH=8, ADDRESS_WIDTH=10)
|
| 265 |
+
(
|
| 266 |
+
input wire clk_a_0,
|
| 267 |
+
input wire write_enable_a_0, read_enable_a_0,
|
| 268 |
+
input wire [DATA_WIDTH-1:0] write_data_a_0,
|
| 269 |
+
input wire [ADDRESS_WIDTH-1:0] addr_a_0,
|
| 270 |
+
output wire [DATA_WIDTH-1:0] read_data_a_0,
|
| 271 |
+
|
| 272 |
+
input wire clk_a_1,
|
| 273 |
+
input wire write_enable_a_1, read_enable_a_1,
|
| 274 |
+
input wire [DATA_WIDTH-1:0] write_data_a_1,
|
| 275 |
+
input wire [ADDRESS_WIDTH-1:0] addr_a_1,
|
| 276 |
+
output wire [DATA_WIDTH-1:0] read_data_a_1,
|
| 277 |
+
|
| 278 |
+
input wire clk_b_0,
|
| 279 |
+
input wire write_enable_b_0, read_enable_b_0,
|
| 280 |
+
input wire [DATA_WIDTH-1:0] write_data_b_0,
|
| 281 |
+
input wire [ADDRESS_WIDTH-1:0] addr_b_0,
|
| 282 |
+
output wire [DATA_WIDTH-1:0] read_data_b_0,
|
| 283 |
+
|
| 284 |
+
input wire clk_b_1,
|
| 285 |
+
input wire write_enable_b_1, read_enable_b_1,
|
| 286 |
+
input wire [DATA_WIDTH-1:0] write_data_b_1,
|
| 287 |
+
input wire [ADDRESS_WIDTH-1:0] addr_b_1,
|
| 288 |
+
output wire [DATA_WIDTH-1:0] read_data_b_1
|
| 289 |
+
);
|
| 290 |
+
|
| 291 |
+
sync_ram_tdp #(
|
| 292 |
+
.DATA_WIDTH(DATA_WIDTH),
|
| 293 |
+
.ADDRESS_WIDTH(ADDRESS_WIDTH)
|
| 294 |
+
) ram_0 (
|
| 295 |
+
.clk_a(clk_a_0),
|
| 296 |
+
.clk_b(clk_b_0),
|
| 297 |
+
.write_enable_a(write_enable_a_0),
|
| 298 |
+
.write_enable_b(write_enable_b_0),
|
| 299 |
+
.read_enable_a(read_enable_a_0),
|
| 300 |
+
.read_enable_b(read_enable_b_0),
|
| 301 |
+
.write_data_a(write_data_a_0),
|
| 302 |
+
.write_data_b(write_data_b_0),
|
| 303 |
+
.addr_a(addr_a_0),
|
| 304 |
+
.addr_b(addr_b_0),
|
| 305 |
+
.read_data_a(read_data_a_0),
|
| 306 |
+
.read_data_b(read_data_b_0)
|
| 307 |
+
);
|
| 308 |
+
|
| 309 |
+
sync_ram_tdp #(
|
| 310 |
+
.DATA_WIDTH(DATA_WIDTH),
|
| 311 |
+
.ADDRESS_WIDTH(ADDRESS_WIDTH)
|
| 312 |
+
) ram_1 (
|
| 313 |
+
.clk_a(clk_a_1),
|
| 314 |
+
.clk_b(clk_b_1),
|
| 315 |
+
.write_enable_a(write_enable_a_1),
|
| 316 |
+
.write_enable_b(write_enable_b_1),
|
| 317 |
+
.read_enable_a(read_enable_a_1),
|
| 318 |
+
.read_enable_b(read_enable_b_1),
|
| 319 |
+
.write_data_a(write_data_a_1),
|
| 320 |
+
.write_data_b(write_data_b_1),
|
| 321 |
+
.addr_a(addr_a_1),
|
| 322 |
+
.addr_b(addr_b_1),
|
| 323 |
+
.read_data_a(read_data_a_1),
|
| 324 |
+
.read_data_b(read_data_b_1)
|
| 325 |
+
);
|
| 326 |
+
|
| 327 |
+
endmodule // double_sync_ram_tdp
|
chips/yosys/tests/arch/common/blockrom.v
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`default_nettype none
|
| 2 |
+
module sync_rom #(parameter DATA_WIDTH=8, ADDRESS_WIDTH=10)
|
| 3 |
+
(input wire clk,
|
| 4 |
+
input wire [ADDRESS_WIDTH-1:0] address_in,
|
| 5 |
+
output wire [DATA_WIDTH-1:0] data_out);
|
| 6 |
+
|
| 7 |
+
localparam WORD = (DATA_WIDTH-1);
|
| 8 |
+
localparam DEPTH = (2**ADDRESS_WIDTH-1);
|
| 9 |
+
|
| 10 |
+
reg [WORD:0] data_out_r;
|
| 11 |
+
reg [WORD:0] memory [0:DEPTH];
|
| 12 |
+
|
| 13 |
+
integer i,j;
|
| 14 |
+
// Initialize in initial block as a workaround for
|
| 15 |
+
// https://github.com/YosysHQ/yosys/issues/4792
|
| 16 |
+
initial begin
|
| 17 |
+
j = 64'hF4B1CA8127865242;
|
| 18 |
+
for (i = 0; i <= DEPTH; i++) begin
|
| 19 |
+
// In case this ROM will be implemented in fabric: fill the memory with some data
|
| 20 |
+
// uncorrelated with the address, or Yosys might see through the ruse and e.g. not
|
| 21 |
+
// emit any LUTs at all for `memory[i] = i;`, just a latch.
|
| 22 |
+
memory[i] = j * 64'h2545F4914F6CDD1D;
|
| 23 |
+
j = j ^ (j >> 12);
|
| 24 |
+
j = j ^ (j << 25);
|
| 25 |
+
j = j ^ (j >> 27);
|
| 26 |
+
end
|
| 27 |
+
end
|
| 28 |
+
|
| 29 |
+
always @(posedge clk) begin
|
| 30 |
+
data_out_r <= memory[address_in];
|
| 31 |
+
end
|
| 32 |
+
|
| 33 |
+
assign data_out = data_out_r;
|
| 34 |
+
|
| 35 |
+
endmodule // sync_rom
|
chips/yosys/tests/arch/common/counter.v
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module top ( out, clk, reset );
|
| 2 |
+
output [7:0] out;
|
| 3 |
+
input clk, reset;
|
| 4 |
+
reg [7:0] out;
|
| 5 |
+
|
| 6 |
+
always @(posedge clk, posedge reset)
|
| 7 |
+
if (reset)
|
| 8 |
+
out <= 8'b0;
|
| 9 |
+
else
|
| 10 |
+
out <= out + 1;
|
| 11 |
+
endmodule
|
chips/yosys/tests/arch/common/dffs.v
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module dff ( input d, clk, output reg q );
|
| 2 |
+
always @( posedge clk )
|
| 3 |
+
q <= d;
|
| 4 |
+
endmodule
|
| 5 |
+
|
| 6 |
+
module dffe( input d, clk, en, output reg q );
|
| 7 |
+
`ifndef NO_INIT
|
| 8 |
+
initial begin
|
| 9 |
+
q = 0;
|
| 10 |
+
end
|
| 11 |
+
`endif
|
| 12 |
+
always @( posedge clk )
|
| 13 |
+
if ( en )
|
| 14 |
+
q <= d;
|
| 15 |
+
endmodule
|
chips/yosys/tests/arch/common/fsm.v
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module fsm ( clock, reset, req_0, req_1, gnt_0, gnt_1 );
|
| 2 |
+
input clock,reset,req_0,req_1;
|
| 3 |
+
output gnt_0,gnt_1;
|
| 4 |
+
wire clock,reset,req_0,req_1;
|
| 5 |
+
reg gnt_0,gnt_1;
|
| 6 |
+
|
| 7 |
+
parameter SIZE = 3;
|
| 8 |
+
parameter IDLE = 3'b001;
|
| 9 |
+
parameter GNT0 = 3'b010;
|
| 10 |
+
parameter GNT1 = 3'b100;
|
| 11 |
+
parameter GNT2 = 3'b101;
|
| 12 |
+
|
| 13 |
+
reg [SIZE-1:0] state;
|
| 14 |
+
reg [SIZE-1:0] next_state;
|
| 15 |
+
|
| 16 |
+
always @ (posedge clock)
|
| 17 |
+
begin : FSM
|
| 18 |
+
if (reset == 1'b1) begin
|
| 19 |
+
state <= #1 IDLE;
|
| 20 |
+
gnt_0 <= 0;
|
| 21 |
+
gnt_1 <= 0;
|
| 22 |
+
end
|
| 23 |
+
else
|
| 24 |
+
case(state)
|
| 25 |
+
IDLE : if (req_0 == 1'b1) begin
|
| 26 |
+
state <= #1 GNT0;
|
| 27 |
+
gnt_0 <= 1;
|
| 28 |
+
end else if (req_1 == 1'b1) begin
|
| 29 |
+
gnt_1 <= 1;
|
| 30 |
+
state <= #1 GNT0;
|
| 31 |
+
end else begin
|
| 32 |
+
state <= #1 IDLE;
|
| 33 |
+
end
|
| 34 |
+
GNT0 : if (req_0 == 1'b1) begin
|
| 35 |
+
state <= #1 GNT0;
|
| 36 |
+
end else begin
|
| 37 |
+
gnt_0 <= 0;
|
| 38 |
+
state <= #1 IDLE;
|
| 39 |
+
end
|
| 40 |
+
GNT1 : if (req_1 == 1'b1) begin
|
| 41 |
+
state <= #1 GNT2;
|
| 42 |
+
gnt_1 <= req_0;
|
| 43 |
+
end
|
| 44 |
+
GNT2 : if (req_0 == 1'b1) begin
|
| 45 |
+
state <= #1 GNT1;
|
| 46 |
+
gnt_1 <= req_1;
|
| 47 |
+
end
|
| 48 |
+
default : state <= #1 IDLE;
|
| 49 |
+
endcase
|
| 50 |
+
end
|
| 51 |
+
endmodule
|
chips/yosys/tests/arch/common/latches.v
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module latchp ( input d, clk, en, output reg q );
|
| 2 |
+
always @*
|
| 3 |
+
if ( en )
|
| 4 |
+
q <= d;
|
| 5 |
+
endmodule
|
| 6 |
+
|
| 7 |
+
module latchn ( input d, clk, en, output reg q );
|
| 8 |
+
always @*
|
| 9 |
+
if ( !en )
|
| 10 |
+
q <= d;
|
| 11 |
+
endmodule
|
| 12 |
+
|
| 13 |
+
module latchsr ( input d, clk, en, clr, pre, output reg q );
|
| 14 |
+
always @*
|
| 15 |
+
if ( clr )
|
| 16 |
+
q <= 1'b0;
|
| 17 |
+
else if ( pre )
|
| 18 |
+
q <= 1'b1;
|
| 19 |
+
else if ( en )
|
| 20 |
+
q <= d;
|
| 21 |
+
endmodule
|
chips/yosys/tests/arch/common/logic.v
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module top
|
| 2 |
+
(
|
| 3 |
+
input [0:7] in,
|
| 4 |
+
output B1,B2,B3,B4,B5,B6,B7,B8,B9,B10
|
| 5 |
+
);
|
| 6 |
+
assign B1 = in[0] & in[1];
|
| 7 |
+
assign B2 = in[0] | in[1];
|
| 8 |
+
assign B3 = in[0] ~& in[1];
|
| 9 |
+
assign B4 = in[0] ~| in[1];
|
| 10 |
+
assign B5 = in[0] ^ in[1];
|
| 11 |
+
assign B6 = in[0] ~^ in[1];
|
| 12 |
+
assign B7 = ~in[0];
|
| 13 |
+
assign B8 = in[0];
|
| 14 |
+
assign B9 = in[0:1] && in [2:3];
|
| 15 |
+
assign B10 = in[0:1] || in [2:3];
|
| 16 |
+
endmodule
|
chips/yosys/tests/arch/common/lutram.v
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module lutram_1w1r
|
| 2 |
+
#(parameter D_WIDTH=8, A_WIDTH=6)
|
| 3 |
+
(
|
| 4 |
+
input [D_WIDTH-1:0] data_a,
|
| 5 |
+
input [A_WIDTH:1] addr_a,
|
| 6 |
+
input we_a, clk,
|
| 7 |
+
output reg [D_WIDTH-1:0] q_a
|
| 8 |
+
);
|
| 9 |
+
// Declare the RAM variable
|
| 10 |
+
reg [D_WIDTH-1:0] ram[(2**A_WIDTH)-1:0];
|
| 11 |
+
|
| 12 |
+
// Port A
|
| 13 |
+
always @ (posedge clk)
|
| 14 |
+
begin
|
| 15 |
+
if (we_a)
|
| 16 |
+
ram[addr_a] <= data_a;
|
| 17 |
+
q_a <= ram[addr_a];
|
| 18 |
+
end
|
| 19 |
+
endmodule
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
module lutram_1w3r
|
| 23 |
+
#(parameter D_WIDTH=8, A_WIDTH=5)
|
| 24 |
+
(
|
| 25 |
+
input [D_WIDTH-1:0] data_a, data_b, data_c,
|
| 26 |
+
input [A_WIDTH:1] addr_a, addr_b, addr_c,
|
| 27 |
+
input we_a, clk,
|
| 28 |
+
output reg [D_WIDTH-1:0] q_a, q_b, q_c
|
| 29 |
+
);
|
| 30 |
+
// Declare the RAM variable
|
| 31 |
+
reg [D_WIDTH-1:0] ram[(2**A_WIDTH)-1:0];
|
| 32 |
+
|
| 33 |
+
// Port A
|
| 34 |
+
always @ (posedge clk)
|
| 35 |
+
begin
|
| 36 |
+
if (we_a)
|
| 37 |
+
ram[addr_a] <= data_a;
|
| 38 |
+
q_a <= ram[addr_a];
|
| 39 |
+
q_b <= ram[addr_b];
|
| 40 |
+
q_c <= ram[addr_c];
|
| 41 |
+
end
|
| 42 |
+
endmodule
|
chips/yosys/tests/arch/common/memory_attributes/attributes_test.v
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`default_nettype none
|
| 2 |
+
module block_ram #(parameter DATA_WIDTH=4, ADDRESS_WIDTH=10)
|
| 3 |
+
(input wire write_enable, clk,
|
| 4 |
+
input wire [DATA_WIDTH-1:0] data_in,
|
| 5 |
+
input wire [ADDRESS_WIDTH-1:0] address_in,
|
| 6 |
+
output wire [DATA_WIDTH-1:0] data_out);
|
| 7 |
+
|
| 8 |
+
localparam WORD = (DATA_WIDTH-1);
|
| 9 |
+
localparam DEPTH = (2**ADDRESS_WIDTH-1);
|
| 10 |
+
|
| 11 |
+
reg [WORD:0] data_out_r;
|
| 12 |
+
reg [WORD:0] memory [0:DEPTH];
|
| 13 |
+
|
| 14 |
+
always @(posedge clk) begin
|
| 15 |
+
if (write_enable)
|
| 16 |
+
memory[address_in] <= data_in;
|
| 17 |
+
data_out_r <= memory[address_in];
|
| 18 |
+
end
|
| 19 |
+
|
| 20 |
+
assign data_out = data_out_r;
|
| 21 |
+
endmodule // block_ram
|
| 22 |
+
|
| 23 |
+
`default_nettype none
|
| 24 |
+
module distributed_ram #(parameter DATA_WIDTH=8, ADDRESS_WIDTH=4)
|
| 25 |
+
(input wire write_enable, clk,
|
| 26 |
+
input wire [DATA_WIDTH-1:0] data_in,
|
| 27 |
+
input wire [ADDRESS_WIDTH-1:0] address_in,
|
| 28 |
+
output wire [DATA_WIDTH-1:0] data_out);
|
| 29 |
+
|
| 30 |
+
localparam WORD = (DATA_WIDTH-1);
|
| 31 |
+
localparam DEPTH = (2**ADDRESS_WIDTH-1);
|
| 32 |
+
|
| 33 |
+
reg [WORD:0] data_out_r;
|
| 34 |
+
reg [WORD:0] memory [0:DEPTH];
|
| 35 |
+
|
| 36 |
+
always @(posedge clk) begin
|
| 37 |
+
if (write_enable)
|
| 38 |
+
memory[address_in] <= data_in;
|
| 39 |
+
data_out_r <= memory[address_in];
|
| 40 |
+
end
|
| 41 |
+
|
| 42 |
+
assign data_out = data_out_r;
|
| 43 |
+
endmodule // distributed_ram
|
| 44 |
+
|
| 45 |
+
`default_nettype none
|
| 46 |
+
module distributed_ram_manual #(parameter DATA_WIDTH=8, ADDRESS_WIDTH=4)
|
| 47 |
+
(input wire write_enable, clk,
|
| 48 |
+
input wire [DATA_WIDTH-1:0] data_in,
|
| 49 |
+
input wire [ADDRESS_WIDTH-1:0] address_in,
|
| 50 |
+
output wire [DATA_WIDTH-1:0] data_out);
|
| 51 |
+
|
| 52 |
+
localparam WORD = (DATA_WIDTH-1);
|
| 53 |
+
localparam DEPTH = (2**ADDRESS_WIDTH-1);
|
| 54 |
+
|
| 55 |
+
reg [WORD:0] data_out_r;
|
| 56 |
+
(* ram_style = "block" *) reg [WORD:0] memory [0:DEPTH];
|
| 57 |
+
|
| 58 |
+
always @(posedge clk) begin
|
| 59 |
+
if (write_enable)
|
| 60 |
+
memory[address_in] <= data_in;
|
| 61 |
+
data_out_r <= memory[address_in];
|
| 62 |
+
end
|
| 63 |
+
|
| 64 |
+
assign data_out = data_out_r;
|
| 65 |
+
endmodule // distributed_ram
|
| 66 |
+
|
| 67 |
+
`default_nettype none
|
| 68 |
+
module distributed_ram_manual_syn #(parameter DATA_WIDTH=8, ADDRESS_WIDTH=4)
|
| 69 |
+
(input wire write_enable, clk,
|
| 70 |
+
input wire [DATA_WIDTH-1:0] data_in,
|
| 71 |
+
input wire [ADDRESS_WIDTH-1:0] address_in,
|
| 72 |
+
output wire [DATA_WIDTH-1:0] data_out);
|
| 73 |
+
|
| 74 |
+
localparam WORD = (DATA_WIDTH-1);
|
| 75 |
+
localparam DEPTH = (2**ADDRESS_WIDTH-1);
|
| 76 |
+
|
| 77 |
+
reg [WORD:0] data_out_r;
|
| 78 |
+
(* synthesis, ram_block *) reg [WORD:0] memory [0:DEPTH];
|
| 79 |
+
|
| 80 |
+
always @(posedge clk) begin
|
| 81 |
+
if (write_enable)
|
| 82 |
+
memory[address_in] <= data_in;
|
| 83 |
+
data_out_r <= memory[address_in];
|
| 84 |
+
end
|
| 85 |
+
|
| 86 |
+
assign data_out = data_out_r;
|
| 87 |
+
endmodule // distributed_ram
|
chips/yosys/tests/arch/common/mul.v
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module top
|
| 2 |
+
#(parameter X_WIDTH=6, Y_WIDTH=6, A_WIDTH=12)
|
| 3 |
+
(
|
| 4 |
+
input [X_WIDTH-1:0] x,
|
| 5 |
+
input [Y_WIDTH-1:0] y,
|
| 6 |
+
|
| 7 |
+
output [A_WIDTH-1:0] A,
|
| 8 |
+
);
|
| 9 |
+
assign A = x * y;
|
| 10 |
+
endmodule
|
chips/yosys/tests/arch/common/mux.v
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module mux2 (S,A,B,Y);
|
| 2 |
+
input S;
|
| 3 |
+
input A,B;
|
| 4 |
+
output reg Y;
|
| 5 |
+
|
| 6 |
+
always @(*)
|
| 7 |
+
Y = (S)? B : A;
|
| 8 |
+
endmodule
|
| 9 |
+
|
| 10 |
+
module mux4 ( S, D, Y );
|
| 11 |
+
input[1:0] S;
|
| 12 |
+
input[3:0] D;
|
| 13 |
+
output Y;
|
| 14 |
+
|
| 15 |
+
reg Y;
|
| 16 |
+
wire[1:0] S;
|
| 17 |
+
wire[3:0] D;
|
| 18 |
+
|
| 19 |
+
always @*
|
| 20 |
+
begin
|
| 21 |
+
case( S )
|
| 22 |
+
0 : Y = D[0];
|
| 23 |
+
1 : Y = D[1];
|
| 24 |
+
2 : Y = D[2];
|
| 25 |
+
3 : Y = D[3];
|
| 26 |
+
endcase
|
| 27 |
+
end
|
| 28 |
+
endmodule
|
| 29 |
+
|
| 30 |
+
module mux8 ( S, D, Y );
|
| 31 |
+
input[2:0] S;
|
| 32 |
+
input[7:0] D;
|
| 33 |
+
output Y;
|
| 34 |
+
|
| 35 |
+
reg Y;
|
| 36 |
+
wire[2:0] S;
|
| 37 |
+
wire[7:0] D;
|
| 38 |
+
|
| 39 |
+
always @*
|
| 40 |
+
begin
|
| 41 |
+
case( S )
|
| 42 |
+
0 : Y = D[0];
|
| 43 |
+
1 : Y = D[1];
|
| 44 |
+
2 : Y = D[2];
|
| 45 |
+
3 : Y = D[3];
|
| 46 |
+
4 : Y = D[4];
|
| 47 |
+
5 : Y = D[5];
|
| 48 |
+
6 : Y = D[6];
|
| 49 |
+
7 : Y = D[7];
|
| 50 |
+
endcase
|
| 51 |
+
end
|
| 52 |
+
endmodule
|
| 53 |
+
|
| 54 |
+
module mux16 (D, S, Y);
|
| 55 |
+
input [15:0] D;
|
| 56 |
+
input [3:0] S;
|
| 57 |
+
output Y;
|
| 58 |
+
|
| 59 |
+
assign Y = D[S];
|
| 60 |
+
endmodule
|
chips/yosys/tests/arch/common/shifter.v
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module top(out, clk, in);
|
| 2 |
+
output [7:0] out;
|
| 3 |
+
input signed clk, in;
|
| 4 |
+
reg signed [7:0] out;
|
| 5 |
+
|
| 6 |
+
`ifndef NO_INIT
|
| 7 |
+
initial begin
|
| 8 |
+
out = 0;
|
| 9 |
+
end
|
| 10 |
+
`endif
|
| 11 |
+
|
| 12 |
+
always @(posedge clk)
|
| 13 |
+
begin
|
| 14 |
+
out <= out >> 1;
|
| 15 |
+
out[7] <= in;
|
| 16 |
+
end
|
| 17 |
+
endmodule
|
chips/yosys/tests/arch/common/tribuf.v
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module tristate(en, i, o);
|
| 2 |
+
input en;
|
| 3 |
+
input i;
|
| 4 |
+
output reg o;
|
| 5 |
+
|
| 6 |
+
always @(en or i)
|
| 7 |
+
o <= (en)? i : 1'bZ;
|
| 8 |
+
endmodule
|
chips/yosys/tests/arch/ecp5/abc9_inout_pad_input.ys
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog <<EOT
|
| 2 |
+
module top(input i, output o);
|
| 3 |
+
wire t;
|
| 4 |
+
inpad u_in (.i(i), .o(t));
|
| 5 |
+
outpad u_out (.i(t), .o(o));
|
| 6 |
+
endmodule
|
| 7 |
+
|
| 8 |
+
module inpad(input i, output o);
|
| 9 |
+
IB ib (.I(i), .O(o));
|
| 10 |
+
endmodule
|
| 11 |
+
|
| 12 |
+
module outpad(input i, output o);
|
| 13 |
+
OB ob (.I(~i), .O(o));
|
| 14 |
+
endmodule
|
| 15 |
+
EOT
|
| 16 |
+
|
| 17 |
+
synth_lattice -family ecp5 -top top
|
| 18 |
+
hierarchy -check
|
| 19 |
+
check -assert
|
| 20 |
+
select -assert-count 2 t:TRELLIS_IO
|
| 21 |
+
select -assert-count 1 t:TRELLIS_IO %x:+[B] w:i %i
|
chips/yosys/tests/arch/ecp5/add_sub.ys
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog ../common/add_sub.v
|
| 2 |
+
hierarchy -top top
|
| 3 |
+
proc
|
| 4 |
+
equiv_opt -assert -map +/ecp5/cells_sim.v synth_ecp5 # equivalency check
|
| 5 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 6 |
+
cd top # Constrain all select calls below inside the top module
|
| 7 |
+
select -assert-min 25 t:LUT4
|
| 8 |
+
select -assert-max 26 t:LUT4
|
| 9 |
+
select -assert-count 10 t:PFUMX
|
| 10 |
+
select -assert-count 6 t:L6MUX21
|
| 11 |
+
select -assert-none t:LUT4 t:PFUMX t:L6MUX21 %% t:* %D
|
chips/yosys/tests/arch/ecp5/adffs.ys
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog ../common/adffs.v
|
| 2 |
+
design -save read
|
| 3 |
+
|
| 4 |
+
hierarchy -top adff
|
| 5 |
+
proc
|
| 6 |
+
equiv_opt -async2sync -assert -map +/ecp5/cells_sim.v synth_ecp5 # equivalency check
|
| 7 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 8 |
+
cd adff # Constrain all select calls below inside the top module
|
| 9 |
+
select -assert-count 1 t:TRELLIS_FF
|
| 10 |
+
select -assert-none t:TRELLIS_FF %% t:* %D
|
| 11 |
+
|
| 12 |
+
design -load read
|
| 13 |
+
hierarchy -top adffn
|
| 14 |
+
proc
|
| 15 |
+
equiv_opt -async2sync -assert -map +/ecp5/cells_sim.v synth_ecp5 # equivalency check
|
| 16 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 17 |
+
cd adffn # Constrain all select calls below inside the top module
|
| 18 |
+
select -assert-count 1 t:TRELLIS_FF
|
| 19 |
+
select -assert-count 1 t:LUT4
|
| 20 |
+
select -assert-none t:TRELLIS_FF t:LUT4 %% t:* %D
|
| 21 |
+
|
| 22 |
+
design -load read
|
| 23 |
+
hierarchy -top dffs
|
| 24 |
+
proc
|
| 25 |
+
equiv_opt -async2sync -assert -map +/ecp5/cells_sim.v synth_ecp5 # equivalency check
|
| 26 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 27 |
+
cd dffs # Constrain all select calls below inside the top module
|
| 28 |
+
select -assert-count 1 t:TRELLIS_FF
|
| 29 |
+
select -assert-count 1 t:LUT4
|
| 30 |
+
select -assert-none t:TRELLIS_FF t:LUT4 %% t:* %D
|
| 31 |
+
|
| 32 |
+
design -load read
|
| 33 |
+
hierarchy -top ndffnr
|
| 34 |
+
proc
|
| 35 |
+
equiv_opt -async2sync -assert -map +/ecp5/cells_sim.v synth_ecp5 # equivalency check
|
| 36 |
+
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
| 37 |
+
cd ndffnr # Constrain all select calls below inside the top module
|
| 38 |
+
select -assert-count 1 t:TRELLIS_FF
|
| 39 |
+
select -assert-count 1 t:LUT4
|
| 40 |
+
select -assert-none t:TRELLIS_FF t:LUT4 %% t:* %D
|
chips/yosys/tests/arch/ecp5/bug1459.ys
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog <<EOT
|
| 2 |
+
module register_file(
|
| 3 |
+
input wire clk,
|
| 4 |
+
input wire write_enable,
|
| 5 |
+
input wire [63:0] write_data,
|
| 6 |
+
input wire [4:0] write_reg,
|
| 7 |
+
input wire [4:0] read1_reg,
|
| 8 |
+
output reg [63:0] read1_data,
|
| 9 |
+
);
|
| 10 |
+
|
| 11 |
+
reg [63:0] registers[0:31];
|
| 12 |
+
|
| 13 |
+
always @(posedge clk) begin
|
| 14 |
+
if (write_enable == 1'b1) begin
|
| 15 |
+
registers[write_reg] <= write_data;
|
| 16 |
+
end
|
| 17 |
+
end
|
| 18 |
+
|
| 19 |
+
always @(all) begin
|
| 20 |
+
read1_data <= registers[read1_reg];
|
| 21 |
+
end
|
| 22 |
+
endmodule
|
| 23 |
+
EOT
|
| 24 |
+
|
| 25 |
+
synth_ecp5 -abc9
|
chips/yosys/tests/arch/ecp5/bug1598.ys
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog <<EOT
|
| 2 |
+
module led_blink (
|
| 3 |
+
input clk,
|
| 4 |
+
output ledc
|
| 5 |
+
);
|
| 6 |
+
|
| 7 |
+
reg [6:0] led_counter = 0;
|
| 8 |
+
always @( posedge clk ) begin
|
| 9 |
+
led_counter <= led_counter + 1;
|
| 10 |
+
end
|
| 11 |
+
assign ledc = !led_counter[ 6:3 ];
|
| 12 |
+
|
| 13 |
+
endmodule
|
| 14 |
+
EOT
|
| 15 |
+
proc
|
| 16 |
+
equiv_opt -assert -map +/ecp5/cells_sim.v synth_ecp5 -abc9
|
chips/yosys/tests/arch/ecp5/bug1630.il.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2251652005079eda64f2ed8311bc425c13f5991972ba2c62923fe0017a22efe6
|
| 3 |
+
size 8527
|
chips/yosys/tests/arch/ecp5/bug1630.ys
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_rtlil bug1630.il.gz
|
| 2 |
+
abc9 -lut 4
|
chips/yosys/tests/arch/ecp5/bug1836.mem
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
0x8000,0x8324,0x8647,0x896a,0x8c8b,0x8fab,0x92c7,0x95e1,
|
| 2 |
+
0x98f8,0x9c0b,0x9f19,0xa223,0xa527,0xa826,0xab1f,0xae10,
|
| 3 |
+
0xb0fb,0xb3de,0xb6b9,0xb98c,0xbc56,0xbf17,0xc1cd,0xc47a,
|
| 4 |
+
0xc71c,0xc9b3,0xcc3f,0xcebf,0xd133,0xd39a,0xd5f5,0xd842,
|
| 5 |
+
0xda82,0xdcb3,0xded7,0xe0eb,0xe2f1,0xe4e8,0xe6cf,0xe8a6,
|
| 6 |
+
0xea6d,0xec23,0xedc9,0xef5e,0xf0e2,0xf254,0xf3b5,0xf504,
|
| 7 |
+
0xf641,0xf76b,0xf884,0xf989,0xfa7c,0xfb5c,0xfc29,0xfce3,
|
| 8 |
+
0xfd89,0xfe1d,0xfe9c,0xff09,0xff61,0xffa6,0xffd8,0xfff5,
|
| 9 |
+
0xffff,0xfff5,0xffd8,0xffa6,0xff61,0xff09,0xfe9c,0xfe1d,
|
| 10 |
+
0xfd89,0xfce3,0xfc29,0xfb5c,0xfa7c,0xf989,0xf884,0xf76b,
|
| 11 |
+
0xf641,0xf504,0xf3b5,0xf254,0xf0e2,0xef5e,0xedc9,0xec23,
|
| 12 |
+
0xea6d,0xe8a6,0xe6cf,0xe4e8,0xe2f1,0xe0eb,0xded7,0xdcb3,
|
| 13 |
+
0xda82,0xd842,0xd5f5,0xd39a,0xd133,0xcebf,0xcc3f,0xc9b3,
|
| 14 |
+
0xc71c,0xc47a,0xc1cd,0xbf17,0xbc56,0xb98c,0xb6b9,0xb3de,
|
| 15 |
+
0xb0fb,0xae10,0xab1f,0xa826,0xa527,0xa223,0x9f19,0x9c0b,
|
| 16 |
+
0x98f8,0x95e1,0x92c7,0x8fab,0x8c8b,0x896a,0x8647,0x8324,
|
| 17 |
+
0x8000,0x7cdb,0x79b8,0x7695,0x7374,0x7054,0x6d38,0x6a1e,
|
| 18 |
+
0x6707,0x63f4,0x60e6,0x5ddc,0x5ad8,0x57d9,0x54e0,0x51ef,
|
| 19 |
+
0x4f04,0x4c21,0x4946,0x4673,0x43a9,0x40e8,0x3e32,0x3b85,
|
| 20 |
+
0x38e3,0x364c,0x33c0,0x3140,0x2ecc,0x2c65,0x2a0a,0x27bd,
|
| 21 |
+
0x257d,0x234c,0x2128,0x1f14,0x1d0e,0x1b17,0x1930,0x1759,
|
| 22 |
+
0x1592,0x13dc,0x1236,0x10a1,0xf1d,0xdab,0xc4a,0xafb,
|
| 23 |
+
0x9be,0x894,0x77b,0x676,0x583,0x4a3,0x3d6,0x31c,
|
| 24 |
+
0x276,0x1e2,0x163,0xf6,0x9e,0x59,0x27,0xa,
|
| 25 |
+
0x0,0xa,0x27,0x59,0x9e,0xf6,0x163,0x1e2,
|
| 26 |
+
0x276,0x31c,0x3d6,0x4a3,0x583,0x676,0x77b,0x894,
|
| 27 |
+
0x9be,0xafb,0xc4a,0xdab,0xf1d,0x10a1,0x1236,0x13dc,
|
| 28 |
+
0x1592,0x1759,0x1930,0x1b17,0x1d0e,0x1f14,0x2128,0x234c,
|
| 29 |
+
0x257d,0x27bd,0x2a0a,0x2c65,0x2ecc,0x3140,0x33c0,0x364c,
|
| 30 |
+
0x38e3,0x3b85,0x3e32,0x40e8,0x43a9,0x4673,0x4946,0x4c21,
|
| 31 |
+
0x4f04,0x51ef,0x54e0,0x57d9,0x5ad8,0x5ddc,0x60e6,0x63f4,
|
| 32 |
+
0x6707,0x6a1e,0x6d38,0x7054,0x7374,0x7695,0x79b8,0x7cdb,
|
chips/yosys/tests/arch/ecp5/bug1836.ys
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog <<EOT
|
| 2 |
+
module top(
|
| 3 |
+
input clk,
|
| 4 |
+
output reg [15:0] sig1, sig2
|
| 5 |
+
);
|
| 6 |
+
reg [7:0] ptr1, ptr2;
|
| 7 |
+
reg [15:0] mem [0:255];
|
| 8 |
+
|
| 9 |
+
initial begin
|
| 10 |
+
$readmemh("bug1836.mem", mem);
|
| 11 |
+
end
|
| 12 |
+
|
| 13 |
+
always @(posedge clk) begin
|
| 14 |
+
sig1 <= mem[ptr1];
|
| 15 |
+
ptr1 <= ptr1 + 3;
|
| 16 |
+
sig2 <= mem[ptr2];
|
| 17 |
+
ptr2 <= ptr2 + 7;
|
| 18 |
+
end
|
| 19 |
+
endmodule
|
| 20 |
+
EOT
|
| 21 |
+
|
| 22 |
+
synth_ecp5 -top top
|
| 23 |
+
select -assert-count 1 t:DP16KD
|
chips/yosys/tests/arch/ecp5/bug2409.ys
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog <<EOT
|
| 2 |
+
module t (...);
|
| 3 |
+
|
| 4 |
+
input CLK;
|
| 5 |
+
input [10:0] A;
|
| 6 |
+
input WE;
|
| 7 |
+
input C;
|
| 8 |
+
input [7:0] DI;
|
| 9 |
+
output reg [7:0] DO;
|
| 10 |
+
|
| 11 |
+
reg [7:0] mem[2047:0];
|
| 12 |
+
|
| 13 |
+
always @(posedge CLK) begin
|
| 14 |
+
if (C)
|
| 15 |
+
if (WE)
|
| 16 |
+
mem[A] <= DI;
|
| 17 |
+
DO <= mem[A];
|
| 18 |
+
end
|
| 19 |
+
|
| 20 |
+
endmodule
|
| 21 |
+
EOT
|
| 22 |
+
|
| 23 |
+
synth_ecp5
|
| 24 |
+
select -assert-count 1 t:DP16KD
|