10  sd0_d0    sd1_d0
 11  sd0_d1    sd1_d1
 12  sd0_d2    sd1_d2
-13  sd0_d3    sd1_d3
+13  sd0_d3    sd1_d3    pwm0
 dedicated
 4              uart1_tx
 5              uart1_rx
 
     "sd_clk": "output",
     "sd_cmd": "output",
     "sd_d": "inout",
+    "pwm": "output"
 }
 
 
 
       (*always_ready,always_enabled*) method Bit#(1) jtag{0}_trst;
       (*always_ready,always_enabled*) method Action jtag{0}_tdo(Bit#(1) in);
 '''
+
+pwminterface_decl = '''
+      (*always_ready,always_enabled*) method Action pwm{0}(Bit#(1) in);
+'''
 # ======================================= #
 
         wrjtag{0}_tdo<=in;
       endmethod
 '''
+
+pwminterface_def = '''
+      method Action pwm{0}(Bit#(1) in);
+        wrpwm{0}<=in;
+      endmethod
+'''
 # ============================================== #
 
 N_TWI = 2
 N_SD = 2
 N_JTAG = 2
+N_PWM = 1
 Addressing = 'WORD'
 ADDR_WIDTH = 32
 DATA_WIDTH = 32
 
     bsv_file.write('''
       // interface declaration between JTAG-{0} and pinmux'''.format(i))
     bsv_file.write(jtaginterface_decl.format(i))
+
+for i in range(0, N_PWM):
+    bsv_file.write('''
+      // interface declaration between PWM-{0} and pinmux'''.format(i))
+    bsv_file.write(pwminterface_decl.format(i))
 # ==============================================================
 
 # ===== finish interface definition and start module definition=======
         '''\n      // following wires capture signals to IO CELL if jtag-{0} is
       // allotted to it'''.format(i))
     bsv_file.write(jtagwires.format(i))
+
+for i in range(0, N_PWM):
+    bsv_file.write(
+        '''\n      // following wires capture signals to IO CELL if pwm-{0} is
+      // allotted to it'''.format(i))
+    bsv_file.write(pwmwires.format(i))
 bsv_file.write("\n")
 # ====================================================================
 # ========================= Actual pinmuxing ========================#
     bsv_file.write(sdinterface_def.format(i))
 for i in range(0, N_JTAG):
     bsv_file.write(jtaginterface_def.format(i))
+for i in range(0, N_PWM):
+    bsv_file.write(pwminterface_def.format(i))
 bsv_file.write(footer)
 print("BSV file successfully generated: bsv_src/pinmux.bsv")
 # ======================================================================
 
                 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,
+                output_en:1, input_en:0, 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,
                 input_en:1, pullup_en:0, pulldown_en:0, pushpull_en:0,
                 drivestrength:0, opendrain_en:0}};
 '''
+
+pwmwires = '''
+      Wire#(Bit#(1)) wrpwm{0} <-mkDWire(0);
+      GenericIOType pwm{0}_io=GenericIOType{{outputval:wrpwm{0},
+                output_en:1, input_en:0, pullup_en:0, pulldown_en:0,
+                pushpull_en:0, drivestrength:0, opendrain_en:0}};
+'''
 # =================================== #