output cell mux peripheral side
[pinmux.git] / src / test_bsv / pinmux_experiment.bsv
index e5a5acd479eadef67af8a2ba7ba49a298b0f7d49..975f86d60c24f3a6ee000be6e8e588c6a230fb18 100644 (file)
@@ -7,9 +7,12 @@
    Date of generation: Sun Jul 22 05:31:10 2018
 */
 
-package pinmux;
+package pinmux_experiment;
 
-   interface MuxSelectionLines;
+import GetPut::*;
+
+      (*always_ready,always_enabled*)
+      interface MuxSelectionLines;
 
       // declare the method which will capture the user pin-mux
       // selection values.The width of the input is dependent on the number
@@ -42,36 +45,39 @@ package pinmux;
                        Action io2_cell_in (Bit#(1) in);
       endinterface
 
-
+      // interface declaration between UART and pinmux
+      (*always_ready,always_enabled*)
       interface PeripheralSideUART;
-          // interface declaration between UART and pinmux
-    (*always_ready,always_enabled*) method  Action tx (Bit#(1) in);
-    (*always_ready,always_enabled*) method  Bit#(1) rx;
+          interface Put#(Bit#(1)) tx;
+          interface Get#(Bit#(1)) rx;
       endinterface
 
+      // interface declaration between GPIOA and pinmux
+      (*always_ready,always_enabled*)
       interface PeripheralSideGPIOA;
-          // interface declaration between GPIOA-0 and pinmux
-    (*always_ready,always_enabled*) method  Action a0_out (Bit#(1) in);
-    (*always_ready,always_enabled*) method  Action a0_outen (Bit#(1) in);
-    (*always_ready,always_enabled*) method  Bit#(1) a0_in;
-    (*always_ready,always_enabled*) method  Action a1_out (Bit#(1) in);
-    (*always_ready,always_enabled*) method  Action a1_outen (Bit#(1) in);
-    (*always_ready,always_enabled*) method  Bit#(1) a1_in;
-    (*always_ready,always_enabled*) method  Action a2_out (Bit#(1) in);
-    (*always_ready,always_enabled*) method  Action a2_outen (Bit#(1) in);
-    (*always_ready,always_enabled*) method  Bit#(1) a2_in;
-        endinterface
+          interface Put#(Bit#(1)) a0_out;
+          interface Put#(Bit#(1)) a0_outen;
+          interface Get#(Bit#(1)) a0_in;
+          interface Put#(Bit#(1)) a1_out;
+          interface Put#(Bit#(1)) a1_outen;
+          interface Get#(Bit#(1)) a1_in;
+          interface Put#(Bit#(1)) a2_out;
+          interface Put#(Bit#(1)) a2_outen;
+          interface Get#(Bit#(1)) a2_in;
+      endinterface
 
+      // interface declaration between TWI and pinmux
+      (*always_ready,always_enabled*)
       interface PeripheralSideTWI;
-          // interface declaration between TWI and pinmux
-    (*always_ready,always_enabled*) method  Action sda_out (Bit#(1) in);
-    (*always_ready,always_enabled*) method  Action sda_outen (Bit#(1) in);
-    (*always_ready,always_enabled*) method  Bit#(1) sda_in;
-    (*always_ready,always_enabled*) method  Action scl_out (Bit#(1) in);
-    (*always_ready,always_enabled*) method  Action scl_outen (Bit#(1) in);
-    (*always_ready,always_enabled*) method  Bit#(1) scl_in;
+          interface Put#(Bit#(1)) sda_out;
+          interface Put#(Bit#(1)) sda_outen;
+          interface Get#(Bit#(1)) sda_in;
+          interface Put#(Bit#(1)) scl_out;
+          interface Put#(Bit#(1)) scl_outen;
+          interface Get#(Bit#(1)) scl_in;
       endinterface
 
+      (*always_ready,always_enabled*)
       interface PeripheralSide;
       // declare the interface to the peripherals
       // Each peripheral's function will be either an input, output
@@ -79,7 +85,6 @@ package pinmux;
       // peripheral and an output field will be an input to the peripheral.
       // Bi-directional functions also have an output-enable (which
       // again comes *in* from the peripheral)
-          // interface declaration between UART-0 and pinmux
             interface PeripheralSideUART uart;
             interface PeripheralSideGPIOA gpioa;
             interface PeripheralSideTWI twi;
@@ -109,98 +114,8 @@ package pinmux;
       // the I/O from the IOcell actually goes.
       interface IOCellSide iocell_side;
    endinterface
-   (*synthesize*)
-
-   module mkgpioa(PeripheralSideGPIOA);
-
-      // allotted to it
-      Wire#(Bit#(1)) wr_a0_out<-mkDWire(0);
-      Wire#(Bit#(1)) wr_a0_outen<-mkDWire(0);
-      Wire#(Bit#(1)) wr_a0_in<-mkDWire(0);
-      Wire#(Bit#(1)) wr_a1_out<-mkDWire(0);
-      Wire#(Bit#(1)) wr_a1_outen<-mkDWire(0);
-      Wire#(Bit#(1)) wr_a1_in<-mkDWire(0);
-      Wire#(Bit#(1)) wr_a2_out<-mkDWire(0);
-      Wire#(Bit#(1)) wr_a2_outen<-mkDWire(0);
-      Wire#(Bit#(1)) wr_a2_in<-mkDWire(0);
-
-    interface gpioa = interface PeripheralSideGPIOA
-
-      method Action  a0_out(Bit#(1) in);
-         wr_a0_out<=in;
-      endmethod
-      method Action  a0_outen(Bit#(1) in);
-         wr_a0_outen<=in;
-      endmethod
-      method a0_in=wr_a0_in;
-      method Action  a1_out(Bit#(1) in);
-         wr_a1_out<=in;
-      endmethod
-      method Action  a1_outen(Bit#(1) in);
-         wr_a1_outen<=in;
-      endmethod
-      method a1_in=wr_a1_in;
-      method Action  a2_out(Bit#(1) in);
-         wr_a2_out<=in;
-      endmethod
-      method Action  a2_outen(Bit#(1) in);
-         wr_a2_outen<=in;
-      endmethod
-      method a2_in=wr_a2_in;
-    endinterface
-
-   endmodule
-
-   module mkuart(PeripheralSideUART);
-
-      Wire#(Bit#(1)) wr_tx<-mkDWire(0);
-      Wire#(Bit#(1)) wr_rx<-mkDWire(0);
-
-    interface uart = interface PeripheralSideUART
-
-      method Action  tx(Bit#(1) in);
-         wr_tx<=in;
-      endmethod
-      method rx=wr_rx;
-     endinterface
-
-   endmodule
-
-
-   module mktwi(PeripheralSideTWI);
-
-      // following wires capture signals to IO CELL if twi-0 is
-      // allotted to it
-      Wire#(Bit#(1)) wr_sda_out<-mkDWire(0);
-      Wire#(Bit#(1)) wr_sda_outen<-mkDWire(0);
-      Wire#(Bit#(1)) wr_sda_in<-mkDWire(0);
-      Wire#(Bit#(1)) wr_scl_out<-mkDWire(0);
-      Wire#(Bit#(1)) wr_scl_outen<-mkDWire(0);
-      Wire#(Bit#(1)) wr_scl_in<-mkDWire(0);
-
-
-    interface twi = interface PeripheralSideTWI
-
-      method Action  sda_out(Bit#(1) in);
-         wr_sda_out<=in;
-      endmethod
-      method Action  sda_outen(Bit#(1) in);
-         wr_sda_outen<=in;
-      endmethod
-      method sda_in=wr_sda_in;
-      method Action  scl_out(Bit#(1) in);
-         wr_scl_out<=in;
-      endmethod
-      method Action  scl_outen(Bit#(1) in);
-         wr_scl_outen<=in;
-      endmethod
-      method scl_in=wr_scl_in;
-
-     endinterface;
-
-   endmodule
-
 
+   (*synthesize*)
    module mkpinmux(Ifc_pinmux);
 
       // the followins wires capture the pin-mux selection
@@ -374,64 +289,102 @@ package pinmux;
 
      endinterface;
 
-    interface peripheral_side_uart = interface PeripheralSideUART
-
-      method Action  tx(Bit#(1) in);
-         wruart_tx<=in;
-      endmethod
-      method rx=wruart_rx;
-     endinterface
-
-    interface peripheral_side_gpioa = interface PeripheralSideGPIOA
-
-      method Action  a0_out(Bit#(1) in);
-         wrgpioa_a0_out<=in;
-      endmethod
-      method Action  a0_outen(Bit#(1) in);
-         wrgpioa_a0_outen<=in;
-      endmethod
-      method a0_in=wrgpioa_a0_in;
-      method Action  a1_out(Bit#(1) in);
-         wrgpioa_a1_out<=in;
-      endmethod
-      method Action  a1_outen(Bit#(1) in);
-         wrgpioa_a1_outen<=in;
-      endmethod
-      method a1_in=wrgpioa_a1_in;
-      method Action  a2_out(Bit#(1) in);
-         wrgpioa_a2_out<=in;
-      endmethod
-      method Action  a2_outen(Bit#(1) in);
-         wrgpioa_a2_outen<=in;
-      endmethod
-      method a2_in=wrgpioa_a2_in;
-    endinterface
-
-    interface peripheral_side_twi = interface PeripheralSideTWI
-
-      method Action  sda_out(Bit#(1) in);
-         wrtwi_sda_out<=in;
-      endmethod
-      method Action  sda_outen(Bit#(1) in);
-         wrtwi_sda_outen<=in;
-      endmethod
-      method sda_in=wrtwi_sda_in;
-      method Action  scl_out(Bit#(1) in);
-         wrtwi_scl_out<=in;
-      endmethod
-      method Action  scl_outen(Bit#(1) in);
-         wrtwi_scl_outen<=in;
-      endmethod
-      method scl_in=wrtwi_scl_in;
-
-     endinterface;
-
-    interface peripheral_side = interface PeripheralSide
-
-      interface uart = uart.mkuart();
-      interface gpioa = gpioa.mkgpioa();
-      interface twi = twi.mktwi();
-
-     endinterface;
+     interface peripheral_side = interface PeripheralSide
+        interface uart = interface PeripheralSideUART
+            interface tx = interface Put
+              method Action put(Bit#(1) in);
+                wruart_tx<=in;
+              endmethod
+            endinterface;
+            interface rx = interface Get
+              method ActionValue#(Bit#(1)) get;
+                return wruart_rx;
+              endmethod
+            endinterface;
+        endinterface;
+
+        interface gpioa = interface PeripheralSideGPIOA
+            interface a0_out = interface Put
+              method Action put(Bit#(1) in);
+                wrgpioa_a0_out<=in;
+              endmethod
+            endinterface;
+            interface a0_outen = interface Put
+              method Action put(Bit#(1) in);
+                wrgpioa_a0_outen<=in;
+              endmethod
+            endinterface;
+            interface a0_in = interface Get
+              method ActionValue#(Bit#(1)) get;
+                return wrgpioa_a0_in;
+              endmethod
+            endinterface;
+            interface a1_out = interface Put
+              method Action put(Bit#(1) in);
+                wrgpioa_a1_out<=in;
+              endmethod
+            endinterface;
+            interface a1_outen = interface Put
+              method Action put(Bit#(1) in);
+                wrgpioa_a1_outen<=in;
+              endmethod
+            endinterface;
+            interface a1_in = interface Get
+              method ActionValue#(Bit#(1)) get;
+                return wrgpioa_a1_in;
+              endmethod
+            endinterface;
+            interface a2_out = interface Put
+              method Action put(Bit#(1) in);
+                wrgpioa_a2_out<=in;
+              endmethod
+            endinterface;
+            interface a2_outen = interface Put
+              method Action put(Bit#(1) in);
+                wrgpioa_a2_outen<=in;
+              endmethod
+            endinterface;
+            interface a2_in = interface Get
+              method ActionValue#(Bit#(1)) get;
+                return wrgpioa_a2_in;
+              endmethod
+            endinterface;
+        endinterface;
+
+        interface twi = interface PeripheralSideTWI
+            interface sda_out = interface Put
+              method Action put(Bit#(1) in);
+                wrtwi_sda_out<=in;
+              endmethod
+            endinterface;
+            interface sda_outen = interface Put
+              method Action put(Bit#(1) in);
+                wrtwi_sda_outen<=in;
+              endmethod
+            endinterface;
+            interface sda_in = interface Get
+              method ActionValue#(Bit#(1)) get;
+                return wrtwi_sda_in;
+              endmethod
+            endinterface;
+            interface scl_out = interface Put
+              method Action put(Bit#(1) in);
+                wrtwi_scl_out<=in;
+              endmethod
+            endinterface;
+            interface scl_outen = interface Put
+              method Action put(Bit#(1) in);
+                wrtwi_scl_outen<=in;
+              endmethod
+            endinterface;
+            interface scl_in = interface Get
+              method ActionValue#(Bit#(1)) get;
+                return wrtwi_scl_in;
+              endmethod
+            endinterface;
+        endinterface;
+
+
+      endinterface;
    endmodule
 endpackage