2011-12-18 15:54:39 -05:00
|
|
|
from migen.fhdl.structure import *
|
2011-12-08 10:35:32 -05:00
|
|
|
from migen.fhdl import verilog
|
|
|
|
|
|
|
|
class LM32:
|
|
|
|
def __init__(self):
|
2011-12-18 15:54:39 -05:00
|
|
|
self.inst = Instance("lm32_top",
|
|
|
|
[("I_ADR_O", BV(32)),
|
|
|
|
("I_DAT_O", BV(32)),
|
|
|
|
("I_SEL_O", BV(4)),
|
|
|
|
("I_CYC_O", BV(1)),
|
|
|
|
("I_STB_O", BV(1)),
|
|
|
|
("I_WE_O", BV(1)),
|
|
|
|
("I_CTI_O", BV(3)),
|
|
|
|
("I_LOCK_O", BV(1)),
|
|
|
|
("I_BTE_O", BV(1)),
|
|
|
|
("D_ADR_O", BV(32)),
|
|
|
|
("D_DAT_O", BV(32)),
|
|
|
|
("D_SEL_O", BV(4)),
|
|
|
|
("D_CYC_O", BV(1)),
|
|
|
|
("D_STB_O", BV(1)),
|
|
|
|
("D_WE_O", BV(1)),
|
|
|
|
("D_CTI_O", BV(3)),
|
|
|
|
("D_LOCK_O", BV(1)),
|
|
|
|
("D_BTE_O", BV(1))],
|
|
|
|
[("interrupt", BV(32)),
|
|
|
|
("ext_break", BV(1)),
|
|
|
|
("I_DAT_I", BV(32)),
|
|
|
|
("I_ACK_I", BV(1)),
|
|
|
|
("I_ERR_I", BV(1)),
|
|
|
|
("I_RTY_I", BV(1)),
|
|
|
|
("D_DAT_I", BV(32)),
|
|
|
|
("D_ACK_I", BV(1)),
|
|
|
|
("D_ERR_I", BV(1)),
|
|
|
|
("D_RTY_I", BV(1))],
|
2012-02-16 12:34:32 -05:00
|
|
|
clkport="clk_i",
|
|
|
|
rstport="rst_i",
|
|
|
|
name="lm32")
|
2011-12-08 10:35:32 -05:00
|
|
|
|
2011-12-16 10:02:55 -05:00
|
|
|
def get_fragment(self):
|
2011-12-18 15:54:39 -05:00
|
|
|
return Fragment(instances=[self.inst])
|
2011-12-08 10:35:32 -05:00
|
|
|
|
|
|
|
cpus = [LM32() for i in range(4)]
|
2011-12-18 15:54:39 -05:00
|
|
|
frag = Fragment()
|
2011-12-08 10:35:32 -05:00
|
|
|
for cpu in cpus:
|
2011-12-16 10:02:55 -05:00
|
|
|
frag += cpu.get_fragment()
|
2012-01-05 13:27:33 -05:00
|
|
|
print(verilog.convert(frag, set([cpus[0].inst.ins["interrupt"], cpus[0].inst.outs["I_WE_O"]])))
|