mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
examples/pytholite/basic: demonstrate conversion to Verilog
This commit is contained in:
parent
7c7addbbe8
commit
748741b49a
1 changed files with 7 additions and 3 deletions
|
@ -3,6 +3,7 @@ from migen.actorlib.sim import *
|
|||
from migen.pytholite.compiler import make_pytholite
|
||||
from migen.sim.generic import Simulator
|
||||
from migen.sim.icarus import Runner
|
||||
from migen.fhdl import verilog
|
||||
|
||||
layout = [("r", BV(32))]
|
||||
|
||||
|
@ -32,12 +33,15 @@ def run_sim(ng):
|
|||
del sim
|
||||
|
||||
def main():
|
||||
print("Simulating native Python:")
|
||||
ng_native = SimActor(number_gen(), ("result", Source, layout))
|
||||
run_sim(ng_native)
|
||||
|
||||
print("Simulating Pytholite:")
|
||||
ng_pytholite = make_pytholite(number_gen, dataflow=[("result", Source, layout)])
|
||||
run_sim(ng_pytholite)
|
||||
|
||||
print("Simulating native Python:")
|
||||
ng_native = SimActor(number_gen(), ("result", Source, layout))
|
||||
run_sim(ng_native)
|
||||
print("Converting Pytholite to Verilog:")
|
||||
print(verilog.convert(ng_pytholite.get_fragment()))
|
||||
|
||||
main()
|
||||
|
|
Loading…
Reference in a new issue