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: Sun Jun 24 12:09:36 2018
12 // FunctionType: contains the active wires of a function. That INCLUDES
13 // GPIO (as GPIO is also a "Function"). These are what get muxed.
14 // However, only GPIO "Functions" will end up with Register SRAMs.
16 Bit#(1) outputval; // output from function to pad bit2
17 Bit#(1) inputval; // input from pad to function bit1
18 Bit#(1) output_en; // output enable from core to pad bit0
19 } FunctionType deriving(Eq,Bits,FShow);
22 Bit#(1) outputval; // output from core to pad bit7
23 Bit#(1) output_en; // output enable from core to pad bit6
24 Bit#(1) input_en; // input enable from core to io_cell bit5
25 } GenericIOType deriving(Eq,Bits,FShow);
27 interface MuxSelectionLines;
29 // declare the method which will capture the user pin-mux
30 // selection values.The width of the input is dependent on the number
31 // of muxes happening per IO. For now we have a generalized width
32 // where each IO will have the same number of muxes.
33 method Action cell0_mux (Bit#(2) in);
34 method Action cell1_mux (Bit#(2) in);
35 method Action cell2_mux (Bit#(2) in);
38 interface PeripheralSide;
39 // declare the interface to the IO cells.
40 // Each IO cell will have 8 input field (output from pin mux
41 // and on output field (input to pinmux)
42 // interface declaration between IO-0 and pinmux
43 (*always_ready,always_enabled*) method Bit#(1) io0_cell_outen;
44 (*always_ready,always_enabled*) method Bit#(1) io0_cell_out;
45 (*always_ready,always_enabled,result="io"*) method
46 Action io0_inputval (Bit#(1) in);
47 // interface declaration between IO-1 and pinmux
48 (*always_ready,always_enabled*) method Bit#(1) io1_cell_outen;
49 (*always_ready,always_enabled*) method Bit#(1) io1_cell_out;
50 (*always_ready,always_enabled,result="io"*) method
51 Action io1_inputval (Bit#(1) in);
52 // interface declaration between IO-2 and pinmux
53 (*always_ready,always_enabled*) method Bit#(1) io2_cell_outen;
54 (*always_ready,always_enabled*) method Bit#(1) io2_cell_out;
55 (*always_ready,always_enabled,result="io"*) method
56 Action io2_inputval (Bit#(1) in);
57 // interface declaration between UART-0 and pinmux
58 (*always_ready,always_enabled*) method Action uart_tx (Bit#(1) in);
59 (*always_ready,always_enabled*) method Bit#(1) uart_rx;
60 // interface declaration between GPIOA-0 and pinmux
61 (*always_ready,always_enabled*) method Action gpioa_a0_out (Bit#(1) in);
62 (*always_ready,always_enabled*) method Action gpioa_a0_outen (Bit#(1) in);
63 (*always_ready,always_enabled*) method Bit#(1) gpioa_a0_in;
64 (*always_ready,always_enabled*) method Action gpioa_a1_out (Bit#(1) in);
65 (*always_ready,always_enabled*) method Action gpioa_a1_outen (Bit#(1) in);
66 (*always_ready,always_enabled*) method Bit#(1) gpioa_a1_in;
67 (*always_ready,always_enabled*) method Action gpioa_a2_out (Bit#(1) in);
68 (*always_ready,always_enabled*) method Action gpioa_a2_outen (Bit#(1) in);
69 (*always_ready,always_enabled*) method Bit#(1) gpioa_a2_in;
70 // interface declaration between TWI-0 and pinmux
71 (*always_ready,always_enabled*) method Action twi_sda_out (Bit#(1) in);
72 (*always_ready,always_enabled*) method Action twi_sda_outen (Bit#(1) in);
73 (*always_ready,always_enabled*) method Bit#(1) twi_sda_in;
74 (*always_ready,always_enabled*) method Action twi_scl_out (Bit#(1) in);
75 (*always_ready,always_enabled*) method Action twi_scl_outen (Bit#(1) in);
76 (*always_ready,always_enabled*) method Bit#(1) twi_scl_in;
80 interface MuxSelectionLines mux_lines;
81 interface PeripheralSide peripheral_side;
84 module mkpinmux(Ifc_pinmux);
86 // the followins wires capture the pin-mux selection
87 // values for each mux assigned to a CELL
89 Wire#(Bit#(1)) wrcell0_mux<-mkDWire(0);
90 Wire#(Bit#(1)) wrcell1_mux<-mkDWire(0);
91 Wire#(Bit#(1)) wrcell2_mux<-mkDWire(0);
92 // following wires capture signals to IO CELL if io-0 is
94 Wire#(Bit#(1)) cell0_mux_out<-mkDWire(0);
95 Wire#(Bit#(1)) cell0_mux_outen<-mkDWire(0);
96 Wire#(Bit#(1)) cell0_mux_in<-mkDWire(0);
98 // following wires capture signals to IO CELL if io-1 is
100 Wire#(Bit#(1)) cell1_mux_out<-mkDWire(0);
101 Wire#(Bit#(1)) cell1_mux_outen<-mkDWire(0);
102 Wire#(Bit#(1)) cell1_mux_in<-mkDWire(0);
104 // following wires capture signals to IO CELL if io-2 is
106 Wire#(Bit#(1)) cell2_mux_out<-mkDWire(0);
107 Wire#(Bit#(1)) cell2_mux_outen<-mkDWire(0);
108 Wire#(Bit#(1)) cell2_mux_in<-mkDWire(0);
110 // following wires capture signals to IO CELL if uart-0 is
112 // declare wruart_tx_*, set up as type 'out'
113 Wire#(Bit#(1)) wruart_tx<-mkDWire(0);
114 // declare wruart_rx_*, set up as type 'input'
115 Wire#(Bit#(1)) wruart_rx<-mkDWire(0);
117 // following wires capture signals to IO CELL if gpioa-0 is
119 Wire#(Bit#(1)) wrgpioa_a0_out<-mkDWire(0);
120 Wire#(Bit#(1)) wrgpioa_a0_outen<-mkDWire(0);
121 Wire#(Bit#(1)) wrgpioa_a0_in<-mkDWire(0);
122 Wire#(Bit#(1)) wrgpioa_a1_out<-mkDWire(0);
123 Wire#(Bit#(1)) wrgpioa_a1_outen<-mkDWire(0);
124 Wire#(Bit#(1)) wrgpioa_a1_in<-mkDWire(0);
125 Wire#(Bit#(1)) wrgpioa_a2_out<-mkDWire(0);
126 Wire#(Bit#(1)) wrgpioa_a2_outen<-mkDWire(0);
127 Wire#(Bit#(1)) wrgpioa_a2_in<-mkDWire(0);
129 // following wires capture signals to IO CELL if twi-0 is
131 // declare wrtwi_sda_*, set up as type 'inout'
132 Wire#(Bit#(1)) wrtwi_sda_out<-mkDWire(0);
133 Wire#(Bit#(1)) wrtwi_sda_outen<-mkDWire(0);
134 Wire#(Bit#(1)) wrtwi_sda_in<-mkDWire(0);
135 // declare wrtwi_scl_*, set up as type 'inout'
136 Wire#(Bit#(1)) wrtwi_scl_out<-mkDWire(0);
137 Wire#(Bit#(1)) wrtwi_scl_outen<-mkDWire(0);
138 Wire#(Bit#(1)) wrtwi_scl_in<-mkDWire(0);
141 /*====== This where the muxing starts for each io-cell======*/
142 // TODO: this needs to stop using GenericIOType and
143 // set the output (and only the output) as a wire
144 // output muxer for cell idx 0
145 cell0_mux_out=wrcell0_mux==0?wrgpioa_a0_out:
146 wrcell0_mux==1?wruart_tx_out:
149 // TODO: here is needed something which sets a new
150 // wire, cell0_mux_outen
152 wrcell0_mux==0?wrgpioa_a0_outen: // bi-directional
153 wrcell0_mux==1?1: // uart_tx is an output
156 rule assign_wrgpioa_a0_in_on_cell0(wrcell0_mux==0);
157 wrgpioa_a0_in<=cell0_mux_in;
160 // TODO: this needs to stop using GenericIOType and
161 // set the output (and only the output) as a wire
162 // output muxer for cell idx 1
163 cell1_mux_out=wrcell1_mux==0?wrgpioa_a1_out:
164 wrcell1_mux==1?0: // uart_rx is an input
167 // TODO: here is needed something which sets a new
168 // wire, cell1_mux_outen
170 wrcell1_mux==0?gpioa_a1_outen: // bi-directional
171 wrcell1_mux==1?0: // uart_rx is an input
172 wrtwi_sda_outen; // bi-directional
174 rule assign_wrgpioa_a1_in_on_cell1(wrcell1_mux==0);
175 wrgpioa_a1_in<=cell1_mux_in;
179 rule assign_wruart_rx_on_cell1(wrcell1_mux==1);
180 wruart_rx<=cell1_mux_in;
184 rule assign_wrtwi_sda_in_on_cell1(wrcell1_mux==2);
185 wrtwi_sda_in<=cell1_mux_in;
188 // TODO: this needs to stop using GenericIOType and
189 // set the output (and only the output) as a wire
190 // output muxer for cell idx 2
192 wrcell2_mux==0?wrgpioa_a2_out:
193 wrcell2_mux==1?0: // unused
196 // TODO: here is needed something which sets a new
197 // wire, cell2_mux_outen
199 wrcell2_mux==0?wrgpioa_a2_outen: // bi-directional
200 wrcell2_mux==1?0: // unused
201 wrtwi_scl_outen; // bi-directional
204 rule assign_wrgpioa_a2_in_on_cell2(wrcell2_mux==0);
205 wrgpioa_a2_in<=cell2_mux_in;
209 rule assign_wrtwi_scl_in_on_cell2(wrcell2_mux==2);
210 wrtwi_scl_in<=cell2_mux_in;
214 /*============================================================*/
216 interface mux_lines = interface MuxSelectionLines
218 method Action cell0_mux(Bit#(1) in);
222 method Action cell1_mux(Bit#(1) in);
226 method Action cell2_mux(Bit#(1) in);
231 interface peripheral_side = interface PeripheralSide
233 method io0_cell_out=cell0_mux_out;
234 method io0_cell_outen=cell0_mux_outen;
235 method Action io0_inputval(Bit#(1) in);
239 method io1_cell_out=cell1_mux_out;
240 method io1_cell_outen=cell1_mux_outen;
241 method Action io1_inputval(Bit#(1) in);
245 method io2_cell_out=cell2_mux_out;
246 method io2_cell_outen=cell2_mux_outen;
247 method Action io2_inputval(Bit#(1) in);
251 method Action uart_tx(Bit#(1) in);
254 method uart_rx=wruart_rx;
256 method Action gpioa_a0_out(Bit#(1) in);
259 method Action gpioa_a0_outen(Bit#(1) in);
260 wrgpioa_a0_outen<=in;
262 method gpioa_a0_in=wrgpioa_a0_in;
263 method Action gpioa_a1_out(Bit#(1) in);
266 method Action gpioa_a1_outen(Bit#(1) in);
267 wrgpioa_a1_outen<=in;
269 method gpioa_a1_in=wrgpioa_a1_in;
270 method Action gpioa_a2_out(Bit#(1) in);
273 method Action gpioa_a2_outen(Bit#(1) in);
274 wrgpioa_a2_outen<=in;
276 method gpioa_a2_in=wrgpioa_a2_in;
278 method Action twi_sda_out(Bit#(1) in);
281 method Action twi_sda_outen(Bit#(1) in);
284 method twi_sda_in=wrtwi_sda_in;
285 method Action twi_scl_out(Bit#(1) in);
288 method Action twi_scl_outen(Bit#(1) in);
291 method twi_scl_in=wrtwi_scl_in;