feat: Add command to generate Verilog

Signed-off-by: Christoph Heiss <contact@christoph-heiss.at>
This commit is contained in:
Christoph Heiss 2022-03-26 21:47:39 +01:00
parent e5cc224fbc
commit 8cbd199e1e
Signed by: c8h4
GPG key ID: 9C82009BEEDEA0FF
3 changed files with 11 additions and 0 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@ dist/
*.o
*.gtkw
*.vcd
*.v

View file

@ -13,6 +13,7 @@ amaranth = "^0.3"
[tool.poetry.scripts]
sim = "teuthida.sim:start"
verilog = "teuthida.gen:gen_verilog"
[build-system]
requires = ["poetry-core>=1.0.0"]

9
teuthida/gen.py Normal file
View file

@ -0,0 +1,9 @@
from amaranth.back import verilog
from . import Cpu
def gen_verilog():
cpu = Cpu()
with open('teuthida.v', 'w') as f:
f.write(verilog.convert(cpu))