3 This BSV file has been generated by the PinMux tool available at:
4 https://bitbucket.org/casl/pinmux.
6 Authors: Neel Gala, Luke
7 Date of generation: Mon Jun 25 15:11:57 2018
12 interface MuxSelectionLines;
14 // declare the method which will capture the user pin-mux
15 // selection values.The width of the input is dependent on the number
16 // of muxes happening per IO. For now we have a generalized width
17 // where each IO will have the same number of muxes.
18 method Action cell0_mux (Bit#(2) in);
19 method Action cell1_mux (Bit#(2) in);
20 method Action cell2_mux (Bit#(2) in);
24 interface PeripheralSide;
25 // declare the interface to the peripherals
26 // Each IO cell will have 3 input field (output from pin mux
27 // and on output field (input to pinmux)
28 // interface declaration between IO-0 and pinmux
29 (*always_ready,always_enabled*) method Bit#(1) io0_cell_out;
30 (*always_ready,always_enabled*) method Bit#(1) io0_cell_outen;
31 (*always_ready,always_enabled,result="io"*) method
32 Action io0_cell_in (Bit#(1) in);
33 // interface declaration between IO-1 and pinmux
34 (*always_ready,always_enabled*) method Bit#(1) io1_cell_out;
35 (*always_ready,always_enabled*) method Bit#(1) io1_cell_outen;
36 (*always_ready,always_enabled,result="io"*) method
37 Action io1_cell_in (Bit#(1) in);
38 // interface declaration between IO-2 and pinmux
39 (*always_ready,always_enabled*) method Bit#(1) io2_cell_out;
40 (*always_ready,always_enabled*) method Bit#(1) io2_cell_outen;
41 (*always_ready,always_enabled,result="io"*) method
42 Action io2_cell_in (Bit#(1) in);
47 // declare the interface to the IO cells.
48 // Each IO cell will have 3 input field (output from pin mux
49 // and on output field (input to pinmux)
50 // interface declaration between UART-0 and pinmux
51 (*always_ready,always_enabled*) method Action uart_tx (Bit#(1) in);
52 (*always_ready,always_enabled*) method Bit#(1) uart_rx;
53 // interface declaration between GPIOA-0 and pinmux
54 (*always_ready,always_enabled*) method Action gpioa_a0_out (Bit#(1) in);
55 (*always_ready,always_enabled*) method Action gpioa_a0_outen (Bit#(1) in);
56 (*always_ready,always_enabled*) method Bit#(1) gpioa_a0_in;
57 (*always_ready,always_enabled*) method Action gpioa_a1_out (Bit#(1) in);
58 (*always_ready,always_enabled*) method Action gpioa_a1_outen (Bit#(1) in);
59 (*always_ready,always_enabled*) method Bit#(1) gpioa_a1_in;
60 (*always_ready,always_enabled*) method Action gpioa_a2_out (Bit#(1) in);
61 (*always_ready,always_enabled*) method Action gpioa_a2_outen (Bit#(1) in);
62 (*always_ready,always_enabled*) method Bit#(1) gpioa_a2_in;
63 // interface declaration between TWI-0 and pinmux
64 (*always_ready,always_enabled*) method Action twi_sda_out (Bit#(1) in);
65 (*always_ready,always_enabled*) method Action twi_sda_outen (Bit#(1) in);
66 (*always_ready,always_enabled*) method Bit#(1) twi_sda_in;
67 (*always_ready,always_enabled*) method Action twi_scl_out (Bit#(1) in);
68 (*always_ready,always_enabled*) method Action twi_scl_outen (Bit#(1) in);
69 (*always_ready,always_enabled*) method Bit#(1) twi_scl_in;
74 interface MuxSelectionLines mux_lines;
75 interface PeripheralSide peripheral_side;
76 interface IOCellSide iocell_side;
79 module mkpinmux(Ifc_pinmux);
81 // the followins wires capture the pin-mux selection
82 // values for each mux assigned to a CELL
84 Wire#(Bit#(2)) wrcell0_mux<-mkDWire(0);
85 Wire#(Bit#(2)) wrcell1_mux<-mkDWire(0);
86 Wire#(Bit#(2)) wrcell2_mux<-mkDWire(0);
87 // following wires capture signals to IO CELL if io-0 is
89 Wire#(Bit#(1)) cell0_mux_out<-mkDWire(0);
90 Wire#(Bit#(1)) cell0_mux_outen<-mkDWire(0);
91 Wire#(Bit#(1)) cell0_mux_in<-mkDWire(0);
93 // following wires capture signals to IO CELL if io-1 is
95 Wire#(Bit#(1)) cell1_mux_out<-mkDWire(0);
96 Wire#(Bit#(1)) cell1_mux_outen<-mkDWire(0);
97 Wire#(Bit#(1)) cell1_mux_in<-mkDWire(0);
99 // following wires capture signals to IO CELL if io-2 is
101 Wire#(Bit#(1)) cell2_mux_out<-mkDWire(0);
102 Wire#(Bit#(1)) cell2_mux_outen<-mkDWire(0);
103 Wire#(Bit#(1)) cell2_mux_in<-mkDWire(0);
105 // following wires capture signals to IO CELL if uart-0 is
107 Wire#(Bit#(1)) wruart_tx<-mkDWire(0);
108 Wire#(Bit#(1)) wruart_rx<-mkDWire(0);
110 // following wires capture signals to IO CELL if gpioa-0 is
112 Wire#(Bit#(1)) wrgpioa_a0_out<-mkDWire(0);
113 Wire#(Bit#(1)) wrgpioa_a0_outen<-mkDWire(0);
114 Wire#(Bit#(1)) wrgpioa_a0_in<-mkDWire(0);
115 Wire#(Bit#(1)) wrgpioa_a1_out<-mkDWire(0);
116 Wire#(Bit#(1)) wrgpioa_a1_outen<-mkDWire(0);
117 Wire#(Bit#(1)) wrgpioa_a1_in<-mkDWire(0);
118 Wire#(Bit#(1)) wrgpioa_a2_out<-mkDWire(0);
119 Wire#(Bit#(1)) wrgpioa_a2_outen<-mkDWire(0);
120 Wire#(Bit#(1)) wrgpioa_a2_in<-mkDWire(0);
122 // following wires capture signals to IO CELL if twi-0 is
124 Wire#(Bit#(1)) wrtwi_sda_out<-mkDWire(0);
125 Wire#(Bit#(1)) wrtwi_sda_outen<-mkDWire(0);
126 Wire#(Bit#(1)) wrtwi_sda_in<-mkDWire(0);
127 Wire#(Bit#(1)) wrtwi_scl_out<-mkDWire(0);
128 Wire#(Bit#(1)) wrtwi_scl_outen<-mkDWire(0);
129 Wire#(Bit#(1)) wrtwi_scl_in<-mkDWire(0);
132 /*====== This where the muxing starts for each io-cell======*/
133 // output muxer for cell idx 0
135 wrcell0_mux==0?wrgpioa_a0_out:
136 wrcell0_mux==1?wruart_tx_out:
137 wrcell0_mux==2?0: // unused
140 // outen muxer for cell idx 0
142 wrcell0_mux==0?wrgpioa_a0_outen: // bi-directional
143 wrcell0_mux==1?1: // uart_tx is an output
144 wrcell0_mux==2?0: // unused
147 rule assign_wrgpioa_a0_in_on_cell0(wrcell0_mux==0);
148 wrgpioa_a0_in<=cell0_mux_in;
151 // output muxer for cell idx 1
153 wrcell1_mux==0?wrgpioa_a1_out:
154 wrcell1_mux==1?0: // uart_rx is an input
155 wrcell1_mux==2?wrtwi_sda_out:
158 // outen muxer for cell idx 1
160 wrcell1_mux==0?wrgpioa_a1_outen: // bi-directional
161 wrcell1_mux==1?0: // uart_rx is an input
162 wrcell1_mux==2?wrtwi_sda_outen: // bi-directional
165 rule assign_wrgpioa_a1_in_on_cell1(wrcell1_mux==0);
166 wrgpioa_a1_in<=cell1_mux_in;
170 rule assign_wruart_rx_on_cell1(wrcell1_mux==1);
171 wruart_rx<=cell1_mux_in;
175 rule assign_wrtwi_sda_in_on_cell1(wrcell1_mux==2);
176 wrtwi_sda_in<=cell1_mux_in;
179 // output muxer for cell idx 2
181 wrcell2_mux==0?wrgpioa_a2_out:
182 wrcell2_mux==1?0: // unused
183 wrcell2_mux==2?wrtwi_scl_out:
186 // outen muxer for cell idx 2
188 wrcell2_mux==0?wrgpioa_a2_outen: // bi-directional
189 wrcell2_mux==1?0: // unused
190 wrcell2_mux==2?wrtwi_scl_outen: // bi-directional
193 rule assign_wrgpioa_a2_in_on_cell2(wrcell2_mux==0);
194 wrgpioa_a2_in<=cell2_mux_in;
198 rule assign_wrtwi_scl_in_on_cell2(wrcell2_mux==2);
199 wrtwi_scl_in<=cell2_mux_in;
203 /*============================================================*/
205 interface mux_lines = interface MuxSelectionLines
207 method Action cell0_mux(Bit#(2) in);
211 method Action cell1_mux(Bit#(2) in);
215 method Action cell2_mux(Bit#(2) in);
220 interface iocell_side = interface IOCellSide
222 method io0_cell_out=cell0_mux_out;
223 method io0_cell_outen=cell0_mux_outen;
224 method Action io0_cell_in(Bit#(1) in);
228 method io1_cell_out=cell1_mux_out;
229 method io1_cell_outen=cell1_mux_outen;
230 method Action io1_cell_in(Bit#(1) in);
234 method io2_cell_out=cell2_mux_out;
235 method io2_cell_outen=cell2_mux_outen;
236 method Action io2_cell_in(Bit#(1) in);
241 interface peripheral_side = interface PeripheralSide
243 method Action uart_tx(Bit#(1) in);
246 method uart_rx=wruart_rx;
248 method Action gpioa_a0_out(Bit#(1) in);
251 method Action gpioa_a0_outen(Bit#(1) in);
252 wrgpioa_a0_outen<=in;
254 method gpioa_a0_in=wrgpioa_a0_in;
255 method Action gpioa_a1_out(Bit#(1) in);
258 method Action gpioa_a1_outen(Bit#(1) in);
259 wrgpioa_a1_outen<=in;
261 method gpioa_a1_in=wrgpioa_a1_in;
262 method Action gpioa_a2_out(Bit#(1) in);
265 method Action gpioa_a2_outen(Bit#(1) in);
266 wrgpioa_a2_outen<=in;
268 method gpioa_a2_in=wrgpioa_a2_in;
270 method Action twi_sda_out(Bit#(1) in);
273 method Action twi_sda_outen(Bit#(1) in);
276 method twi_sda_in=wrtwi_sda_in;
277 method Action twi_scl_out(Bit#(1) in);
280 method Action twi_scl_outen(Bit#(1) in);
283 method twi_scl_in=wrtwi_scl_in;