5 uart1_rx
6 twi1_sda
7 twi1_scl
+14 jtag0_tclk
+15 jtag0_tdo
+16 jtag0_tdi
+17 jtag0_tms
+18 jtag0_tdo
(*always_ready,always_enabled*) method Action sd{0}_d3_outen (Bit#(1) in);
(*always_ready,always_enabled*) method Bit#(1) sd{0}_d3_in;
'''
+
+jtaginterface_decl = '''
+ (*always_ready,always_enabled*) method Bit#(1) jtag{0}_tdi;
+ (*always_ready,always_enabled*) method Bit#(1) jtag{0}_tms;
+ (*always_ready,always_enabled*) method Bit#(1) jtag{0}_tclk;
+ (*always_ready,always_enabled*) method Bit#(1) jtag{0}_trst;
+ (*always_ready,always_enabled*) method Action jtag{0}_tdo(Bit#(1) in);
+'''
# ======================================= #
endmethod
method sd{0}_d3_in=wrsd{0}_d3_in;
'''
+
+jtaginterface_def = '''
+ method Bit#(1) jtag{0}_tdi=wrjtag{0}_tdi;
+ method Bit#(1) jtag{0}_tms=wrjtag{0}_tms;
+ method Bit#(1) jtag{0}_tclk=wrjtag{0}_tclk;
+ method Bit#(1) jtag{0}_trst=wrjtag{0}_trst;
+ method Action jtag{0}_tdo(Bit#(1) in);
+ wrjtag{0}_tdo<=in;
+ endmethod
+'''
# ============================================== #
N_SPI = 1
N_TWI = 2
N_SD = 2
+N_JTAG = 2
# ================ #
bsv_file.write('''
// interface declaration between SD-{0} and pinmux'''.format(i))
bsv_file.write(sdinterface_decl.format(i))
+
+for i in range(0, N_JTAG):
+ bsv_file.write('''
+ // interface declaration between JTAG-{0} and pinmux'''.format(i))
+ bsv_file.write(jtaginterface_decl.format(i))
# ==============================================================
# ===== finish interface definition and start module definition=======
'''\n // following wires capture signals to IO CELL if sd-{0} is
// allotted to it'''.format(i))
bsv_file.write(sdwires.format(i))
+
+for i in range(0, N_JTAG):
+ bsv_file.write(
+ '''\n // following wires capture signals to IO CELL if jtag-{0} is
+ // allotted to it'''.format(i))
+ bsv_file.write(jtagwires.format(i))
bsv_file.write("\n")
# ====================================================================
# ========================= Actual pinmuxing ========================#
bsv_file.write(twiinterface_def.format(i))
for i in range(0, N_SD):
bsv_file.write(sdinterface_def.format(i))
+for i in range(0, N_JTAG):
+ bsv_file.write(jtaginterface_def.format(i))
bsv_file.write(footer)
print("BSV file successfully generated: bsv_src/pinmux.bsv")
# ======================================================================
pullup_en:0, pulldown_en:0, pushpull_en:0, drivestrength:0,
opendrain_en:0}};
'''
+
+jtagwires = '''
+ Wire#(Bit#(1)) wrjtag{0}_tdi<-mkDWire(0);
+ Wire#(Bit#(1)) wrjtag{0}_tms<-mkDWire(0);
+ Wire#(Bit#(1)) wrjtag{0}_tclk<-mkDWire(0);
+ Wire#(Bit#(1)) wrjtag{0}_trst<-mkDWire(0);
+ Wire#(Bit#(1)) wrjtag{0}_tdo<-mkDWire(0);
+ GenericIOType jtag{0}_tdi_io=GenericIOType{{outputval:0, output_en:0,
+ input_en:1, pullup_en:0, pulldown_en:0, pushpull_en:0,
+ drivestrength:0, opendrain_en:0}};
+ GenericIOType jtag{0}_tdo_io=GenericIOType{{outputval:wrjtag{0}_tdo,
+ output_en:0, input_en:1, pullup_en:0, pulldown_en:0,
+ pushpull_en:0, drivestrength:0, opendrain_en:0}};
+ GenericIOType jtag{0}_tms_io=GenericIOType{{outputval:0, output_en:0,
+ input_en:1, pullup_en:0, pulldown_en:0, pushpull_en:0,
+ drivestrength:0, opendrain_en:0}};
+ GenericIOType jtag{0}_trst_io=GenericIOType{{outputval:0, output_en:0,
+ input_en:1, pullup_en:0, pulldown_en:0, pushpull_en:0,
+ drivestrength:0, opendrain_en:0}};
+ GenericIOType jtag{0}_tclk_io=GenericIOType{{outputval:0, output_en:0,
+ input_en:1, pullup_en:0, pulldown_en:0, pushpull_en:0,
+ drivestrength:0, opendrain_en:0}};
+'''
# =================================== #