def __init__(self, name):
self.name = name
- def slowifdeclmux(self):
+ def slowifdeclmux(self, name, count):
return ''
- def slowifinstance(self):
+ def slowifinstance(self, name, count):
return ''
def slowimport(self):
def slowifinstance(self, *args):
ret = []
for (name, count) in self.ifacecount:
- #print "slowimport", name, self.data[name].slowimport
- ret.append(self.data[name].slowifinstance())
+ for i in range(count):
+ ret.append(self.data[name].slowifinstance(name, i))
return '\n'.join(list(filter(None, ret)))
def slowifdeclmux(self, *args):
ret = []
for (name, count) in self.ifacecount:
for i in range(count):
- ret.append(self.data[name].slowifdeclmux().format(i, name))
+ ret.append(self.data[name].slowifdeclmux(name, i))
return '\n'.join(list(filter(None, ret)))
def slowifdecl(self, *args):
" import mux::*;\n" + \
" import gpio::*;\n"
- def slowifdeclmux(self):
+ def slowifdeclmux(self, name, count):
size = len(self.peripheral.pinspecs)
- return " interface GPIO_config#(%d) pad_config{0};" % size
+ return " interface GPIO_config#(%d) pad_config%d;" % \
+ (size, count)
def num_axi_regs32(self):
return 2
def axi_addr_map(self, name, ifacenum):
return ''
- def slowifdeclmux(self):
- return " method Action jtag_ms (Bit#(1) in);\n" + \
- " method Bit#(1) jtag_di;\n" + \
- " method Action jtag_do (Bit#(1) in);\n" + \
- " method Action jtag_ck (Bit#(1) in);"
-
- def slowifinstance(self):
- return jtag_method_template # bit of a lazy hack this...
-
-
-jtag_method_template = """\
- method Action jtag_ms (Bit#(1) in);
- pinmux.peripheral_side.jtag_ms(in);
- endmethod
- method Bit#(1) jtag_di=pinmux.peripheral_side.jtag_di;
- method Action jtag_do (Bit#(1) in);
- pinmux.peripheral_side.jtag_do(in);
- endmethod
- method Action jtag_ck (Bit#(1) in);
- pinmux.peripheral_side.jtag_ck(in);
- endmethod
-"""
+ def slowifdeclmux(self, name, count):
+ sname = self.get_iname(count)
+ return " interface PeripheralSideJTAG %s;" % sname
+
+ def slowifinstance(self, name, count):
+ sname = self.peripheral.iname().format(count)
+ pname = self.get_iname(count)
+ template = " interface {0} = pinmux.peripheral_side.{1};"
+ return template.format(pname, sname)
+
name = self.get_iname(inum)
return " method {0}_isint = {0}.interrupts[5];".format(name)
- def slowifdeclmux(self):
- return " method Bit#(1) {1}{0}_isint;"
+ def slowifdeclmux(self, name, count):
+ sname = self.peripheral.iname().format(count)
+ return " method Bit#(1) %s_isint;" % sname
name = self.get_iname(inum)
return " method {0}_intr = {0}.irq;".format(name)
- def slowifdeclmux(self):
- return " method Bit#(1) {1}{0}_intr;"
+ def slowifdeclmux(self, name, count):
+ sname = self.peripheral.iname().format(count)
+ return " method Bit#(1) %s_intr;" % sname
uart_plic_template = """\
ret.append(template.format(ps, ptype, n))
return '\n'.join(ret)
+ def slowifdeclmux(self, name, count):
+ sname = self.get_iname(count)
+ return " interface PeripheralSideLCD %s;" % sname
+
+ def slowifinstance(self, name, count):
+ sname = self.peripheral.iname().format(count)
+ pname = self.get_iname(count)
+ template = " interface {0} = pinmux.peripheral_side.{1};"
+ return template.format(pname, sname)
name = self.get_iname(inum)
return " method {0}_isint = {0}.isint;".format(name)
- def slowifdeclmux(self):
- return " method Bit#(1) {1}{0}_isint;"
+ def slowifdeclmux(self, name, inum):
+ sname = self.get_iname(inum)
+ return " method Bit#(1) %s_isint;" % sname