add boilerplate for API generation tests

This commit is contained in:
Fischer Moseley 2023-03-23 23:50:09 -04:00
parent 18fcbfe1f2
commit d5dfd3bbf3
16 changed files with 116 additions and 56 deletions

113
Makefile
View File

@ -8,58 +8,6 @@ lint:
python3 -m black src/manta/__init__.py
python3 -m black src/manta/__main__.py
sim: io_core_tb logic_analyzer_tb bit_fifo_tb bridge_rx_tb bridge_tx_tb fifo_tb lut_ram_tb uart_tb uart_tx_tb
io_core_tb:
iverilog -g2012 -o sim.out test/io_core_tb.sv src/manta/io_core.v
vvp sim.out
rm sim.out
logic_analyzer_tb:
iverilog -g2012 -o sim.out test/logic_analyzer_tb.sv src/manta/logic_analyzer.v src/manta/la_fsm.v src/manta/trigger_block.v src/manta/trigger.v src/manta/sample_mem.v src/manta/xilinx_true_dual_port_read_first_2_clock_ram.v
vvp sim.out
rm sim.out
bit_fifo_tb:
iverilog -g2012 -o sim.out test/bit_fifo_tb.sv src/manta/bit_fifo.v
vvp sim.out
rm sim.out
bridge_rx_tb:
iverilog -g2012 -o sim.out test/bridge_rx_tb.sv src/manta/bridge_rx.v
vvp sim.out
rm sim.out
bridge_tx_tb:
iverilog -g2012 -o sim.out test/bridge_tx_tb.sv src/manta/bridge_tx.v src/manta/uart_tx.v
vvp sim.out
rm sim.out
fifo_tb:
iverilog -g2012 -o sim.out test/fifo_tb.sv src/manta/fifo.v src/manta/xilinx_true_dual_port_read_first_2_clock_ram.v
vvp sim.out >> /dev/null # this one is noisy right now
rm sim.out
lut_ram_tb:
iverilog -g2012 -o sim.out test/lut_ram_tb.sv src/manta/lut_ram.v
vvp sim.out
rm sim.out
uart_tb:
iverilog -g2012 -o sim.out test/uart_tb.sv src/manta/tx_uart.v src/manta/uart_rx.v
vvp sim.out
rm sim.out
uart_tx_tb:
iverilog -g2012 -o sim.out test/uart_tx_tb.sv src/manta/tx_uart.v src/manta/uart_tx.v src/manta/rx_uart.v
vvp sim.out
rm sim.out
clean:
rm -f *.out *.vcd
rm -rf dist/
rm -rf src/mantaray.egg-info
serve_docs:
mkdocs serve
@ -67,4 +15,63 @@ total_loc:
find . -type f \( -iname \*.sv -o -iname \*.v -o -iname \*.py -o -iname \*.yaml -o -iname \*.yml -o -iname \*.md \) | sed 's/.*/"&"/' | xargs wc -l
real_loc:
find src test -type f \( -iname \*.sv -o -iname \*.v -o -iname \*.py -o -iname \*.yaml -o -iname \*.md \) | sed 's/.*/"&"/' | xargs wc -l
find src ${TB} -type f \( -iname \*.sv -o -iname \*.v -o -iname \*.py -o -iname \*.yaml -o -iname \*.md \) | sed 's/.*/"&"/' | xargs wc -l
test: api_gen func_sim
# API Generation Tests
api_gen:
python3 test/api_gen/run_test.py
# Functional Simulation
func_sim: io_core_tb logic_analyzer_tb bit_fifo_tb bridge_rx_tb bridge_tx_tb fifo_tb lut_ram_tb uart_tb uart_tx_tb
io_core_tb:
iverilog -g2012 -o sim.out test/hdl_tb/io_core_tb.sv -y src/manta
vvp sim.out
rm sim.out
logic_analyzer_tb:
iverilog -g2012 -o sim.out test/hdl_tb/logic_analyzer_tb.sv -y src/manta
vvp sim.out
rm sim.out
bit_fifo_tb:
iverilog -g2012 -o sim.out test/hdl_tb/bit_fifo_tb.sv -y src/manta
vvp sim.out
rm sim.out
bridge_rx_tb:
iverilog -g2012 -o sim.out test/hdl_tb/bridge_rx_tb.sv -y src/manta
vvp sim.out
rm sim.out
bridge_tx_tb:
iverilog -g2012 -o sim.out test/hdl_tb/bridge_tx_tb.sv -y src/manta
vvp sim.out
rm sim.out
fifo_tb:
iverilog -g2012 -o sim.out test/hdl_tb/fifo_tb.sv -y src/manta
vvp sim.out >> /dev/null # this one is noisy right now
rm sim.out
lut_ram_tb:
iverilog -g2012 -o sim.out test/hdl_tb/lut_ram_tb.sv -y src/manta
vvp sim.out
rm sim.out
uart_tb:
iverilog -g2012 -o sim.out test/hdl_tb/uart_tb.sv -y src/manta
vvp sim.out
rm sim.out
uart_tx_tb:
iverilog -g2012 -o sim.out test/hdl_tb/uart_tx_tb.sv -y src/manta
vvp sim.out
rm sim.out
clean:
rm -f *.out *.vcd
rm -rf dist/
rm -rf src/mantaray.egg-info

View File

@ -1,11 +1,8 @@
# ToDo
## IO Core
- test examples that build
- add logic for ports >16 bits in width
- clock domain crossing
- figure out what happens for module naming - it's possible we could have two modules that have the same ports but have different names
- do we say that port names have to be globally unique? or do we allow something like `module_name_module_type_inst` for example
## Logic Analyzer Core
- need to finish up simulations, those might get broken out into separate testbenches for each module

1
test/api_gen/run_test.py Normal file
View File

@ -0,0 +1 @@
# try to build manta instances from valid and invalid configuration files

View File

@ -0,0 +1,26 @@
---
cores:
my_io_core:
type: io
inputs:
btnu: 1
btnd: 1
btnl: 1
btnr: 1
btnc: 1
sw: 16
outputs:
led: 16
led16_b: 1
led16_g: 1
led16_r: 1
led17_b: 1
led17_g: 1
led17_r: 1
uart:
port: "auto"
baudrate: 115200
clock_freq: 100000000

View File

@ -0,0 +1,19 @@
---
cores:
my_logic_analyzer:
type: logic_analyzer
sample_depth: 4096
probes:
larry: 1
curly: 1
moe: 1
shemp: 4
triggers:
- larry && curly && ~moe
uart:
port: "auto"
baudrate: 115200
clock_freq: 100000000

View File

@ -0,0 +1,10 @@
---
cores:
my_lut_ram:
type: lut_ram
size: 64
uart:
port: "auto"
baudrate: 115200
clock_freq: 100000000