From: Neel Date: Sat, 21 Jul 2018 12:03:33 +0000 (+0530) Subject: add jtag through pinmux X-Git-Url: https://git.libre-soc.org/?p=pinmux.git;a=commitdiff_plain;h=5959f9f2d0c5bd5275223a016367df41a8f21656 add jtag through pinmux --- diff --git a/src/bsv/bsv_lib/slow_peripherals_template.bsv b/src/bsv/bsv_lib/slow_peripherals_template.bsv index 1f1d1c8..88cebac 100644 --- a/src/bsv/bsv_lib/slow_peripherals_template.bsv +++ b/src/bsv/bsv_lib/slow_peripherals_template.bsv @@ -360,6 +360,7 @@ package slow_peripherals; // NEEL EDIT interface iocell_side=pinmux.iocell_side; interface pad_config0= gpioa.pad_config; +{9} // NEEL EDIT OVER /*===================================*/ endmodule diff --git a/src/bsv/peripheral_gen.py b/src/bsv/peripheral_gen.py index eee4cf7..ff74a04 100644 --- a/src/bsv/peripheral_gen.py +++ b/src/bsv/peripheral_gen.py @@ -9,6 +9,9 @@ class PBase(object): def slowifdeclmux(self): return '' + def slowifinstance(self): + return '' + def slowimport(self): return '' @@ -331,6 +334,39 @@ eint_pincon_template = '''\ ''' +class jtag(PBase): + + def axi_slave_name(self, name, ifacenum): + return '' + + def axi_slave_idx(self, idx, name, ifacenum): + return ('', 0) + + 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 +""" + class sdmmc(PBase): def slowimport(self): @@ -620,7 +656,8 @@ class PeripheralIface(object): if slow: self.slow = slow(ifacename) self.slow.peripheral = self - for fname in ['slowimport', 'slowifdecl', 'slowifdeclmux', + for fname in ['slowimport', + 'slowifinstance', 'slowifdecl', 'slowifdeclmux', 'mkslow_peripheral', 'mk_connection', 'mk_cellconn', 'mk_pincon']: fn = CallFn(self, fname) @@ -661,6 +698,13 @@ class PeripheralInterfaces(object): ret.append(self.data[name].slowimport()) return '\n'.join(list(filter(None, ret))) + def slowifinstance(self, *args): + ret = [] + for (name, count) in self.ifacecount: + #print "slowimport", name, self.data[name].slowimport + ret.append(self.data[name].slowifinstance()) + return '\n'.join(list(filter(None, ret))) + def slowifdeclmux(self, *args): ret = [] for (name, count) in self.ifacecount: @@ -762,6 +806,7 @@ class PFactory(object): 'pwm': pwm, 'eint': eint, 'sd': sdmmc, + 'jtag': jtag, 'gpio': gpio }.items(): if name.startswith(k): diff --git a/src/bsv/pinmux_generator.py b/src/bsv/pinmux_generator.py index 680f659..ae39958 100644 --- a/src/bsv/pinmux_generator.py +++ b/src/bsv/pinmux_generator.py @@ -120,10 +120,11 @@ def write_slow(slow, template, p, ifaces, iocells): mkcon = ifaces.mk_connection() mkcellcon = ifaces.mk_cellconn() pincon = ifaces.mk_pincon() + inst = ifaces.slowifinstance() with open(slow, "w") as bsv_file: bsv_file.write(template.format(imports, ifdecl, regdef, slavedecl, fnaddrmap, mkslow, mkcon, mkcellcon, - pincon)) + pincon, inst)) def write_bus(bus, p, ifaces): diff --git a/src/spec/minitest.py b/src/spec/minitest.py index a60d31e..fb3901f 100644 --- a/src/spec/minitest.py +++ b/src/spec/minitest.py @@ -33,8 +33,7 @@ def pinspec(): function_names = {'EINT': 'External Interrupt', 'FB': 'MC68k FlexBus', 'IIS': 'I2S Audio', - 'JTAG0': 'JTAG (same as JTAG1, JTAG_SEL=LOW)', - 'JTAG1': 'JTAG (same as JTAG0, JTAG_SEL=HIGH)', + 'JTAG': 'JTAG (JTAG_SEL=HI/LO)', 'LCD': '24-pin RGB/TTL LCD', 'RG': 'RGMII Ethernet', 'MMC': 'eMMC 1/2/4/8 pin', @@ -73,10 +72,10 @@ def pinspec(): ps.eint("", ('A', 20), 2, 4, 1) ps.eint("", ('A', 23), 1, 5, 1) ps.sdmmc("1", ('A', 4), 3) - ps.jtag("1", ('A', 10), 3) + ps.jtag("", ('A', 10), 3) ps.uartfull("0", ('A', 14), 3) ps.uartfull("1", ('A', 18), 3) - ps.jtag("0", ('A', 24), 2) + ps.jtag("", ('A', 24), 2) ps.spi("1", ('A', 24), 1) ps.i2c("0", ('A', 0), 2) ps.uart("1", ('A', 2), 2) @@ -95,7 +94,7 @@ def pinspec(): minitest_pwm = ['B2:PWM_0'] descriptions = { 'MMC': 'internal (on Card)', - 'SD0': 'user-facing: internal (on Card), multiplexed with JTAG1\n' + 'SD0': 'user-facing: internal (on Card), multiplexed with JTAG\n' 'and UART2, for debug purposes', 'TWI2': 'I2C.\n', 'E2:SD1': '',