add in quart
authorNeel <neelgala@gmail.com>
Sat, 21 Jul 2018 12:51:27 +0000 (18:21 +0530)
committerNeel <neelgala@gmail.com>
Sat, 21 Jul 2018 12:51:27 +0000 (18:21 +0530)
src/bsv/peripheral_gen.py

index ff74a04ec92a7901d362d86cc10541e53704eb3b..5326144bcae74927cbc0ae2fb704eafcdf5d5e38 100644 (file)
@@ -187,31 +187,51 @@ class uart(PBase):
         return {'rx': 'coe_rs232.sin'}.get(pname, '')
 
 
-class qquart(PBase):
+class quart(PBase):
 
     def slowimport(self):
         return "          import Uart16550         :: *;"
 
     def slowifdecl(self):
-        return "            interface RS232_PHY_Ifc uart{0}_coe;\n" + \
-               "            method Bit#(1) uart{0}_intr;"
+        return "            interface RS232_PHY_Ifc quart{0}_coe;\n" + \
+               "            method Bit#(1) quart{0}_intr;"
 
     def num_axi_regs32(self):
         return 8
 
     def mkslow_peripheral(self, size=0):
-        return "        Uart16550_AXI4_Lite_Ifc uart{0} <- \n" + \
+        return "        Uart16550_AXI4_Lite_Ifc quart{0} <- \n" + \
                "                mkUart16550(clocked_by sp_clock,\n" + \
                "                    reset_by uart_reset, sp_clock, sp_reset);"
 
     def _mk_connection(self, name=None, count=0):
-        return "uart{0}.slave_axi_uart"
+        return "quart{0}.slave_axi_uart"
 
     def pinname_out(self, pname):
-        return {'tx': 'coe_rs232.sout'}.get(pname, '')
+        return {'tx' : 'coe_rs232.modem_output_stx',
+                'rts': 'coe_rs232.modem_output_rts',
+               }.get(pname, '')
 
-    def pinname_in(self, pname):
-        return {'rx': 'coe_rs232.sin'}.get(pname, '')
+    def _pinname_in(self, pname):
+        return {'rx': 'coe_rs232.modem_input.srx', 
+                'cts': 'coe_rs232.modem_input.cts'
+               }.get(pname, '')
+
+    def mk_pincon(self, name, count):
+        ret = [PBase.mk_pincon(self, name, count)]
+        size = len(self.peripheral.pinspecs)
+        ret.append(eint_pincon_template.format(size))
+        ret.append("    rule con_%s%d_io_in;" % (name, count))
+        ret.append("       {0}{1}.coe_rs232.modem_input(".format(name, count))
+        for idx, pname in enumerate(['rx', 'cts']):
+            sname = self.peripheral.pname(pname).format(count)
+            ps = "pinmux.peripheral_side.%s" % sname
+            ret.append("            {0},".format(ps))
+        ret.append("            1'b1,1'b0,1'b1")
+        ret.append("        );")
+        ret.append("    endrule")
+
+        return '\n'.join(ret)
 
 
 class rs232(PBase):
@@ -801,6 +821,7 @@ class PFactory(object):
         for k, v in {'uart': uart,
                      'rs232': rs232,
                      'twi': twi,
+                     'quart': quart,
                      'qspi': qspi,
                      'spi': spi,
                      'pwm': pwm,