Skip to content

Commit

Permalink
Merge pull request #16 from fischermoseley/amaranth_rewrite
Browse files Browse the repository at this point in the history
Rewrite Manta in Amaranth HDL
  • Loading branch information
fischermoseley committed Mar 7, 2024
2 parents e094865 + e0aeb38 commit 8efbad4
Show file tree
Hide file tree
Showing 201 changed files with 9,950 additions and 8,623 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build_docs
name: docs_site
on:
push:
branches:
Expand All @@ -17,5 +17,5 @@ jobs:
with:
key: ${{ github.ref }}
path: .cache
- run: pip install mkdocs-material
- run: pip install mkdocs-material
- run: mkdocs gh-deploy --force
25 changes: 0 additions & 25 deletions .github/workflows/build_examples.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/formal_verification.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/functional_simulation.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: run_tests
on: [push]
jobs:
all:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4

- name: Install Manta from Source
run: |
# Make venv
python3 -m venv venv/
source venv/bin/activate
# Update pip
python3 -m pip install -U pip
# omitting the following commmand causes the version of setuptools
# used by python to get confused, and it doesn't detect the name
# or version of the package from pyproject.toml - so the following
# workaround is used:
# https://github.com/pypa/setuptools/issues/3269#issuecomment-1254507377
export DEB_PYTHON_INSTALL_LAYOUT=deb_system
# Install Manta, with optional dev-only dependencies
python3 -m pip install ".[dev]"
- name: Run tests
run: |
source ./environment.sh
source venv/bin/activate
make test
38 changes: 18 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,30 @@
.DS_Store
*.vscode/

# Python outputs
# Python files
venv/
dist/
build/
*.egg-info
manta.egg-info/
.pytest_cache
__pycache__/
build/

# Miscellaneous file types
*.v
*.sv
*.vcd
*.out
*.csv

# Vivado output products
*.Xil/
# Vivado files
*.log
*.jou
*.rpt
*.bit
cpu_impl_netlist.v

# IceStorm output products
*.bin

# iVerilog output products
*.vcd
*.bit
*.out
.Xil/

# Formal outputs
test/formal_verification/*_basic
test/formal_verification/*_cover

# Manta output products
manta.v
*.mem
# Yosys/IceStorm files
*.asc
*.bin
*.json
123 changes: 6 additions & 117 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,123 +1,12 @@
# Tool Paths
VIVADO=/tools/Xilinx/Vivado/2023.1/bin/vivado
YOSYS=/tools/oss-cad-suite/bin/yosys
NEXTPNR_ICE40=/tools/oss-cad-suite/bin/nextpnr-ice40
ICEPACK=/tools/oss-cad-suite/bin/icepack
.PHONY: test format clean serve_docs
test:
python3 -m pytest

test: auto_gen sim formal

examples: icestick nexys_a7
format:
python3 -m black .

clean:
@echo "Deleting everything matched by .gitignore"
git clean -Xdf

serve_docs:
preview_site:
mkdocs serve

# Python Operations
python_build:
python3 -m build

pypi_upload: build
python3 -m twine upload --repository testpypi dist/*

python_lint:
python3 -m black src/manta/__init__.py
python3 -m black src/manta/__main__.py

# API Generation Tests
auto_gen:
python3 test/auto_gen/run_tests.py

# Build Examples
NEXYS_A7_EXAMPLES := io_core_ether io_core_uart ps2_logic_analyzer video_sprite_ether video_sprite_uart block_mem_uart logic_analyzer_uart large_io_core_uart

.PHONY: nexys_a7 $(NEXYS_A7_EXAMPLES)
nexys_a7: $(NEXYS_A7_EXAMPLES)

$(NEXYS_A7_EXAMPLES):
cd examples/nexys_a7/$@; \
python3 -m manta gen manta.yaml src/manta.v; \
rm -rf obj; \
mkdir -p obj; \
$(VIVADO) -mode batch \
-source ../build.tcl \
-log obj/build.log \
-jou obj/build.jou; \
rm -rf .Xil;

ICESTICK_EXAMPLES := io_core

.PHONY: icestick $(ICESTICK_EXAMPLES)
icestick: $(ICESTICK_EXAMPLES)

$(ICESTICK_EXAMPLES):
cd examples/icestick/$@; \
python3 -m manta gen manta.yaml manta.v; \
$(YOSYS) -p 'synth_ice40 -top top_level -json top_level.json' top_level.sv; \
$(NEXTPNR_ICE40) --hx1k --json top_level.json --pcf top_level.pcf --asc top_level.asc; \
$(ICEPACK) top_level.asc top_level.bin; \
rm -f *.json; \
rm -f *.asc;

# Formal Verification
formal:
sby -f test/formal_verification/bridge_rx.sby

# Functional Simulation
sim: ethernet_tx_tb ethernet_rx_tb mac_tb block_memory_tb io_core_tb logic_analyzer_tb bridge_rx_tb bridge_tx_tb block_memory_tb

ethernet_tx_tb:
iverilog -g2012 -o sim.out -y src/manta/ether_iface test/functional_sim/ethernet_tx_tb.sv
vvp sim.out
rm sim.out

ethernet_rx_tb:
iverilog -g2012 -o sim.out -y src/manta/ether_iface test/functional_sim/ethernet_rx_tb.sv
vvp sim.out
rm sim.out

mac_tb:
iverilog -g2012 -o sim.out -y src/manta/ether_iface test/functional_sim/mac_tb.sv
vvp sim.out
rm sim.out

block_memory_tb:
iverilog -g2012 -o sim.out -y src/manta/block_mem_core test/functional_sim/block_memory_tb.sv
vvp sim.out
rm sim.out

io_core_tb:
iverilog -g2012 -o sim.out \
test/functional_sim/io_core_tb/io_core_tb.sv \
test/functional_sim/io_core_tb/io_core.v
vvp sim.out
rm sim.out

logic_analyzer_tb:
cd test/functional_sim/logic_analyzer_tb; \
python3 -m manta gen manta.yaml manta.v; \
iverilog -g2012 -o sim.out logic_analyzer_tb.sv manta.v; \
vvp sim.out; \
rm sim.out

bridge_rx_tb:
iverilog -g2012 -o sim.out -y src/manta/uart_iface test/functional_sim/bridge_rx_tb.sv
vvp sim.out
rm sim.out

bridge_tx_tb:
iverilog -g2012 -o sim.out -y src/manta/uart_iface test/functional_sim/bridge_tx_tb.sv
vvp sim.out
rm sim.out

uart_rx_tb:
iverilog -g2012 -o sim.out -y src/manta/uart_iface test/functional_sim/uart_rx_tb.sv
vvp sim.out
rm sim.out

uart_tx_tb:
iverilog -g2012 -o sim.out -y src/manta/uart_iface test/functional_sim/uart_tx_tb.sv
vvp sim.out
rm sim.out
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
![](doc/assets/logo.png)

## Manta: A Configurable and Approachable Tool for FPGA Debugging and Rapid Prototyping
![functional_simulation](https://github.com/fischermoseley/manta/actions/workflows/functional_simulation.yml/badge.svg)
![formal_verification](https://github.com/fischermoseley/manta/actions/workflows/formal_verification.yml/badge.svg)
![build_examples](https://github.com/fischermoseley/manta/actions/workflows/build_examples.yml/badge.svg)
![run_tests](https://github.com/fischermoseley/manta/actions/workflows/run_tests.yml/badge.svg)
![build_docs](https://github.com/fischermoseley/manta/actions/workflows/build_docs.yml/badge.svg)

[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

Expand Down
Loading

0 comments on commit 8efbad4

Please sign in to comment.