2015-03-01 12:27:46 -05:00
|
|
|
from mibuild.generic_platform import *
|
2015-03-27 09:14:49 -04:00
|
|
|
from mibuild.sim import SimPlatform
|
2015-03-01 12:27:46 -05:00
|
|
|
|
2015-04-13 14:45:35 -04:00
|
|
|
|
2015-03-01 12:27:46 -05:00
|
|
|
class SimPins(Pins):
|
2015-04-13 14:07:07 -04:00
|
|
|
def __init__(self, n):
|
|
|
|
Pins.__init__(self, "s "*n)
|
2015-03-01 12:27:46 -05:00
|
|
|
|
|
|
|
_io = [
|
2015-04-13 14:07:07 -04:00
|
|
|
("sys_clk", 0, SimPins(1)),
|
|
|
|
("sys_rst", 0, SimPins(1)),
|
|
|
|
("serial", 0,
|
|
|
|
Subsignal("source_stb", SimPins(1)),
|
|
|
|
Subsignal("source_ack", SimPins(1)),
|
|
|
|
Subsignal("source_data", SimPins(8)),
|
2015-03-01 12:27:46 -05:00
|
|
|
|
2015-04-13 14:07:07 -04:00
|
|
|
Subsignal("sink_stb", SimPins(1)),
|
|
|
|
Subsignal("sink_ack", SimPins(1)),
|
|
|
|
Subsignal("sink_data", SimPins(8)),
|
|
|
|
),
|
|
|
|
("eth_clocks", 0,
|
|
|
|
Subsignal("none", SimPins(1)),
|
|
|
|
),
|
|
|
|
("eth", 0,
|
|
|
|
Subsignal("source_stb", SimPins(1)),
|
|
|
|
Subsignal("source_ack", SimPins(1)),
|
|
|
|
Subsignal("source_data", SimPins(8)),
|
2015-03-06 04:20:26 -05:00
|
|
|
|
2015-04-13 14:07:07 -04:00
|
|
|
Subsignal("sink_stb", SimPins(1)),
|
|
|
|
Subsignal("sink_ack", SimPins(1)),
|
|
|
|
Subsignal("sink_data", SimPins(8)),
|
|
|
|
),
|
2015-03-01 12:27:46 -05:00
|
|
|
]
|
|
|
|
|
2015-04-13 14:45:35 -04:00
|
|
|
|
2015-03-27 09:14:49 -04:00
|
|
|
class Platform(SimPlatform):
|
2015-04-13 14:07:07 -04:00
|
|
|
is_sim = True
|
|
|
|
default_clk_name = "sys_clk"
|
|
|
|
default_clk_period = 1000 # on modern computers simulate at ~ 1MHz
|
2015-03-13 18:17:45 -04:00
|
|
|
|
2015-04-13 14:07:07 -04:00
|
|
|
def __init__(self):
|
|
|
|
SimPlatform.__init__(self, "SIM", _io)
|
2015-03-01 12:27:46 -05:00
|
|
|
|
2015-04-13 14:07:07 -04:00
|
|
|
def do_finalize(self, fragment):
|
|
|
|
pass
|