pep8 cleanup
[pinmux.git] / src / bsv / peripheral_gen / twi.py
1 from bsv.peripheral_gen.base import PBase
2
3
4 class twi(PBase):
5
6 def slowimport(self):
7 return " import I2C_top :: *;"
8
9 def slowifdecl(self):
10 return " interface I2C_out twi{0}_out;\n" + \
11 " method Bit#(1) twi{0}_isint;"
12
13 def num_axi_regs32(self):
14 return 8
15
16 def mkslow_peripheral(self, size=0):
17 return " I2C_IFC twi{0} <- mkI2CController();"
18
19 def _mk_connection(self, name=None, count=0):
20 return "twi{0}.slave_i2c_axi"
21
22 def pinname_out(self, pname):
23 return {'sda': 'out.sda_out',
24 'scl': 'out.scl_out'}.get(pname, '')
25
26 def pinname_in(self, pname):
27 return {'sda': 'out.sda_in',
28 'scl': 'out.scl_in'}.get(pname, '')
29
30 def pinname_outen(self, pname):
31 return {'sda': 'out.sda_out_en',
32 'scl': 'out.scl_out_en'}.get(pname, '')
33
34 def num_irqs(self):
35 return 3
36
37 def plic_object(self, pname, idx):
38 return ["{0}.isint()",
39 "{0}.timerint()",
40 "{0}.isber()"
41 ][idx].format(pname)
42
43 def mk_ext_ifacedef(self, iname, inum):
44 name = self.get_iname(inum)
45 return " method {0}_isint = {0}.isint;".format(name)
46
47 def slowifdeclmux(self):
48 return " method Bit#(1) {1}{0}_isint;"