mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
examples/pytholite: use new APIs
This commit is contained in:
parent
69dbf84e54
commit
c99cc9343f
2 changed files with 14 additions and 14 deletions
|
@ -17,8 +17,7 @@ def run_sim(ng):
|
||||||
g.add_connection(ng, d)
|
g.add_connection(ng, d)
|
||||||
|
|
||||||
c = CompositeActor(g)
|
c = CompositeActor(g)
|
||||||
fragment = c.get_fragment()
|
sim = Simulator(c)
|
||||||
sim = Simulator(fragment)
|
|
||||||
sim.run(30)
|
sim.run(30)
|
||||||
del sim
|
del sim
|
||||||
|
|
||||||
|
@ -32,6 +31,6 @@ def main():
|
||||||
run_sim(ng_pytholite)
|
run_sim(ng_pytholite)
|
||||||
|
|
||||||
print("Converting Pytholite to Verilog:")
|
print("Converting Pytholite to Verilog:")
|
||||||
print(verilog.convert(ng_pytholite.get_fragment()))
|
print(verilog.convert(ng_pytholite))
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -7,6 +7,7 @@ from migen.uio.ioo import UnifiedIOSimulation
|
||||||
from migen.pytholite.transel import Register
|
from migen.pytholite.transel import Register
|
||||||
from migen.pytholite.compiler import make_pytholite
|
from migen.pytholite.compiler import make_pytholite
|
||||||
from migen.sim.generic import Simulator
|
from migen.sim.generic import Simulator
|
||||||
|
from migen.fhdl.module import Module
|
||||||
from migen.fhdl.specials import Memory
|
from migen.fhdl.specials import Memory
|
||||||
from migen.fhdl import verilog
|
from migen.fhdl import verilog
|
||||||
|
|
||||||
|
@ -29,18 +30,18 @@ class SlaveModel(wishbone.TargetModel):
|
||||||
def read(self, address):
|
def read(self, address):
|
||||||
return address + 4
|
return address + 4
|
||||||
|
|
||||||
|
class TestBench(Module):
|
||||||
|
def __init__(self, ng):
|
||||||
|
g = DataFlowGraph()
|
||||||
|
d = Dumper(layout)
|
||||||
|
g.add_connection(ng, d)
|
||||||
|
|
||||||
|
self.submodules.slave = wishbone.Target(SlaveModel())
|
||||||
|
self.submodules.intercon = wishbone.InterconnectPointToPoint(ng.buses["wb"], self.slave.bus)
|
||||||
|
self.submodules.ca = CompositeActor(g)
|
||||||
|
|
||||||
def run_sim(ng):
|
def run_sim(ng):
|
||||||
g = DataFlowGraph()
|
sim = Simulator(TestBench(ng))
|
||||||
d = Dumper(layout)
|
|
||||||
g.add_connection(ng, d)
|
|
||||||
|
|
||||||
slave = wishbone.Target(SlaveModel())
|
|
||||||
intercon = wishbone.InterconnectPointToPoint(ng.buses["wb"], slave.bus)
|
|
||||||
|
|
||||||
c = CompositeActor(g)
|
|
||||||
fragment = slave.get_fragment() + intercon.get_fragment() + c.get_fragment()
|
|
||||||
|
|
||||||
sim = Simulator(fragment)
|
|
||||||
sim.run(50)
|
sim.run(50)
|
||||||
del sim
|
del sim
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue