corrections to inferface reader, add unit tests
[pinmux.git] / src / interface_def.py
index 07d3b3f580bdf6a89137dc1411e5cc85a5defd9f..07088b16663be5b0e06e1e13a974a9df64233114 100644 (file)
@@ -1,58 +1,58 @@
 # === templates for interface definitions ====== #
 mux_interface_def = '''
-      method Action cell{0}_mux (Bit#({1}) in );
-         wrmux{0}<=in;
+      method Action  cell{0}_mux(Bit#({1}) in);
+         wrcell{0}_mux<=in;
       endmethod
 '''
 io_interface_def = '''
-      method io_outputval_{0}=cell{0}_out.outputval;
-      method io_output_en_{0}=cell{0}_out.output_en;
-      method io_input_en_{0}=cell{0}_out.input_en;
-      method io_pullup_en_{0}=cell{0}_out.pullup_en;
-      method io_pulldown_en_{0}=cell{0}_out.pulldown_en;
-      method io_drivestrength_{0}=cell{0}_out.drivestrength;
-      method io_pushpull_en_{0}=cell{0}_out.pushpull_en;
-      method io_opendrain_en_{0}=cell{0}_out.opendrain_en;
-      method Action  io_inputval_{0}(Bit#(1) in);
-         cell{0}_in<=in;
+      method io{0}_outputval=cell{0}_mux_out.outputval;
+      method io{0}_output_en=cell{0}_mux_out.output_en;
+      method io{0}_input_en=cell{0}_mux_out.input_en;
+      method io{0}_pullup_en=cell{0}_mux_out.pullup_en;
+      method io{0}_pulldown_en=cell{0}_mux_out.pulldown_en;
+      method io{0}_drivestrength=cell{0}_mux_out.drivestrength;
+      method io{0}_pushpull_en=cell{0}_mux_out.pushpull_en;
+      method io{0}_opendrain_en=cell{0}_mux_out.opendrain_en;
+      method Action  io{0}_inputval(Bit#(1) in);
+         cell{0}_mux_in<=in;
       endmethod
 '''
 uartinterface_def = '''
-      method rx_{0}=wruart{0}_rx;
-      method Action tx_{0}(Bit#(1) in);
+      method uart{0}_rx=wruart{0}_rx;
+      method Action uart{0}_tx(Bit#(1) in);
          wruart{0}_tx<=in;
       endmethod
 '''
 spiinterface_def = '''
-      method Action sclk_{0} (Bit#(1) in);
+      method Action spi{0}_sclk (Bit#(1) in);
          wrspi{0}_sclk<=in;
       endmethod
-      method Action mosi_{0} (Bit#(1) in);
+      method Action spi{0}_mosi (Bit#(1) in);
          wrspi{0}_mosi<=in;
       endmethod
-      method Action ss_{0}   (Bit#(1) in);
-         wrspi{0}_ss<=in;
+      method Action spi{0}_nss   (Bit#(1) in);
+         wrspi{0}_nss<=in;
       endmethod
-      method Bit#(1) miso_{0}=wrspi{0}_miso;
+      method Bit#(1) spi{0}_miso=wrspi{0}_miso;
 '''
 
 twiinterface_def = '''
 
-      method Action sda{0}_out (Bit#(1) in);
+      method Action twi{0}_sda_out (Bit#(1) in);
          wrtwi{0}_sda_out<=in;
       endmethod
-      method Action sda{0}_outen (Bit#(1) in);
+      method Action twi{0}_sda_outen (Bit#(1) in);
          wrtwi{0}_sda_outen<=in;
       endmethod
-      method sda{0}_in=wrtwi{0}_sda_in;
+      method twi{0}_sda_in=wrtwi{0}_sda_in;
 
-      method Action scl{0}_out (Bit#(1) in);
+      method Action twi{0}_scl_out (Bit#(1) in);
          wrtwi{0}_scl_out<=in;
       endmethod
-      method Action scl{0}_outen (Bit#(1) in);
+      method Action twi{0}_scl_outen (Bit#(1) in);
          wrtwi{0}_scl_outen<=in;
       endmethod
-      method scl{0}_in=wrtwi{0}_scl_in;
+      method twi{0}_scl_in=wrtwi{0}_scl_in;
 
 '''
 
@@ -102,4 +102,10 @@ jtaginterface_def = '''
         wrjtag{0}_tdo<=in;
       endmethod
 '''
+
+pwminterface_def = '''
+      method Action pwm{0}_pwm(Bit#(1) in);
+        wrpwm{0}_pwm<=in;
+      endmethod
+'''
 # ============================================== #