7f5b9f6accff7c31996f0b905611ae178e600428
[pinmux.git] / src / wire_def.py
1 # == Intermediate wire definitions ==#
2 muxwire = '''
3 Wire#(Bit#({1})) wrcell{0}_mux<-mkDWire(0);'''
4 generic_io = '''
5 GenericIOType cell{0}_mux_out=unpack(0);
6 Wire#(Bit#(1)) cell{0}_mux_in<-mkDWire(0);
7 '''
8 uartwires = '''
9 Wire#(Bit#(1)) wruart{0}_rx<-mkDWire(0);
10 Wire#(Bit#(1)) wruart{0}_tx<-mkDWire(0);
11 GenericIOType uart{0}_rx_io = GenericIOType{{
12 outputval:0,
13 output_en:0,
14 input_en:1,
15 pullup_en:0,
16 pulldown_en:0,
17 pushpull_en:0,
18 drivestrength:0,
19 opendrain_en:0
20 }};
21 GenericIOType uart{0}_tx_io = GenericIOType{{
22 outputval:wruart{0}_tx,
23 output_en:1,
24 input_en:0,
25 pullup_en:0,
26 pulldown_en:0,
27 pushpull_en:0,
28 drivestrength:0,
29 opendrain_en:0
30 }};
31 '''
32 spiwires = '''
33 Wire#(Bit#(1)) wrspi{0}_sclk<-mkDWire(0);
34 Wire#(Bit#(1)) wrspi{0}_mosi<-mkDWire(0);
35 Wire#(Bit#(1)) wrspi{0}_nss<-mkDWire(0);
36 Wire#(Bit#(1)) wrspi{0}_miso<-mkDWire(0);
37 GenericIOType spi{0}_sclk_io = GenericIOType{{
38 outputval:wrspi{0}_sclk,
39 output_en:1,
40 input_en:0,
41 pullup_en:0,
42 pulldown_en:0,
43 pushpull_en:0,
44 drivestrength:0,
45 opendrain_en:0
46 }};
47 GenericIOType spi{0}_mosi_io = GenericIOType{{
48 outputval:wrspi{0}_mosi,
49 output_en:1,
50 input_en:0,
51 pullup_en:0,
52 pulldown_en:0,
53 pushpull_en:0,
54 drivestrength:0,
55 opendrain_en:0
56 }};
57 GenericIOType spi{0}_nss_io = GenericIOType{{
58 outputval:wrspi{0}_nss,
59 output_en:1,
60 input_en:0,
61 pullup_en:0,
62 pulldown_en:0,
63 pushpull_en:0,
64 drivestrength:0,
65 opendrain_en:0
66 }};
67 GenericIOType spi{0}_miso_io = GenericIOType{{
68 outputval:0,
69 output_en:0,
70 input_en:1,
71 pullup_en:0,
72 pulldown_en:0,
73 pushpull_en:0,
74 drivestrength:0,
75 opendrain_en:0
76 }};
77 '''
78 twiwires = '''
79 Wire#(Bit#(1)) wrtwi{0}_sda_out<-mkDWire(0);
80 Wire#(Bit#(1)) wrtwi{0}_sda_outen<-mkDWire(0);
81 Wire#(Bit#(1)) wrtwi{0}_sda_in<-mkDWire(0);
82 Wire#(Bit#(1)) wrtwi{0}_scl_out<-mkDWire(0);
83 Wire#(Bit#(1)) wrtwi{0}_scl_outen<-mkDWire(0);
84 Wire#(Bit#(1)) wrtwi{0}_scl_in<-mkDWire(0);
85 GenericIOType twi{0}_sda_io = GenericIOType{{
86 outputval:wrtwi{0}_sda_out,
87 output_en:wrtwi{0}_sda_outen,
88 input_en:~wrtwi{0}_sda_outen,
89 pullup_en:0,
90 pulldown_en:0,
91 pushpull_en:0,
92 drivestrength:0,
93 opendrain_en:0
94 }};
95 GenericIOType twi{0}_scl_io = GenericIOType{{
96 outputval:wrtwi{0}_scl_out,
97 output_en:wrtwi{0}_scl_outen,
98 input_en:~wrtwi{0}_scl_outen,
99 pullup_en:0,
100 pulldown_en:0,
101 pushpull_en:0,
102 drivestrength:0,
103 opendrain_en:0
104 }};
105 '''
106
107 sdwires = '''
108 Wire#(Bit#(1)) wrsd{0}_clk<-mkDWire(0);
109 Wire#(Bit#(1)) wrsd{0}_cmd<-mkDWire(0);
110 Wire#(Bit#(1)) wrsd{0}_d0_out<-mkDWire(0);
111 Wire#(Bit#(1)) wrsd{0}_d0_outen<-mkDWire(0);
112 Wire#(Bit#(1)) wrsd{0}_d0_in<-mkDWire(0);
113 Wire#(Bit#(1)) wrsd{0}_d1_out<-mkDWire(0);
114 Wire#(Bit#(1)) wrsd{0}_d1_outen<-mkDWire(0);
115 Wire#(Bit#(1)) wrsd{0}_d1_in<-mkDWire(0);
116 Wire#(Bit#(1)) wrsd{0}_d2_out<-mkDWire(0);
117 Wire#(Bit#(1)) wrsd{0}_d2_outen<-mkDWire(0);
118 Wire#(Bit#(1)) wrsd{0}_d2_in<-mkDWire(0);
119 Wire#(Bit#(1)) wrsd{0}_d3_out<-mkDWire(0);
120 Wire#(Bit#(1)) wrsd{0}_d3_outen<-mkDWire(0);
121 Wire#(Bit#(1)) wrsd{0}_d3_in<-mkDWire(0);
122 GenericIOType sd{0}_clk_io = GenericIOType{{
123 outputval:wrsd{0}_clk,
124 output_en:1,
125 input_en:0,
126 pullup_en:0,
127 pulldown_en:0,
128 pushpull_en:0,
129 drivestrength:0,
130 opendrain_en:0
131 }};
132 GenericIOType sd{0}_cmd_io = GenericIOType{{
133 outputval:wrsd{0}_cmd,
134 output_en:1,
135 input_en:0,
136 pullup_en:0,
137 pulldown_en:0,
138 pushpull_en:0,
139 drivestrength:0,
140 opendrain_en:0
141 }};
142 GenericIOType sd{0}_d0_io = GenericIOType{{
143 outputval:wrsd{0}_d0_out,
144 output_en:wrsd{0}_d0_outen,
145 input_en:~wrsd{0}_d0_outen,
146 pullup_en:0,
147 pulldown_en:0,
148 pushpull_en:0,
149 drivestrength:0,
150 opendrain_en:0
151 }};
152 GenericIOType sd{0}_d1_io = GenericIOType{{
153 outputval:wrsd{0}_d1_out,
154 output_en:wrsd{0}_d1_outen,
155 input_en:~wrsd{0}_d1_outen,
156 pullup_en:0,
157 pulldown_en:0,
158 pushpull_en:0,
159 drivestrength:0,
160 opendrain_en:0
161 }};
162 GenericIOType sd{0}_d2_io = GenericIOType{{
163 outputval:wrsd{0}_d2_out,
164 output_en:wrsd{0}_d2_outen,
165 input_en:~wrsd{0}_d2_outen,
166 pullup_en:0,
167 pulldown_en:0,
168 pushpull_en:0,
169 drivestrength:0,
170 opendrain_en:0
171 }};
172 GenericIOType sd{0}_d3_io = GenericIOType{{
173 outputval:wrsd{0}_d3_out,
174 output_en:wrsd{0}_d3_outen,
175 input_en:~wrsd{0}_d3_outen,
176 pullup_en:0,
177 pulldown_en:0,
178 pushpull_en:0,
179 drivestrength:0,
180 opendrain_en:0
181 }};
182 '''
183
184 jtagwires = '''
185 Wire#(Bit#(1)) wrjtag{0}_tdi<-mkDWire(0);
186 Wire#(Bit#(1)) wrjtag{0}_tms<-mkDWire(0);
187 Wire#(Bit#(1)) wrjtag{0}_tclk<-mkDWire(0);
188 Wire#(Bit#(1)) wrjtag{0}_trst<-mkDWire(0);
189 Wire#(Bit#(1)) wrjtag{0}_tdo<-mkDWire(0);
190 GenericIOType jtag{0}_tdi_io = GenericIOType{{
191 outputval:0,
192 output_en:0,
193 input_en:1,
194 pullup_en:0,
195 pulldown_en:0,
196 pushpull_en:0,
197 drivestrength:0,
198 opendrain_en:0
199 }};
200 GenericIOType jtag{0}_tms_io = GenericIOType{{
201 outputval:0,
202 output_en:0,
203 input_en:1,
204 pullup_en:0,
205 pulldown_en:0,
206 pushpull_en:0,
207 drivestrength:0,
208 opendrain_en:0
209 }};
210 GenericIOType jtag{0}_tclk_io = GenericIOType{{
211 outputval:0,
212 output_en:0,
213 input_en:1,
214 pullup_en:0,
215 pulldown_en:0,
216 pushpull_en:0,
217 drivestrength:0,
218 opendrain_en:0
219 }};
220 GenericIOType jtag{0}_trst_io = GenericIOType{{
221 outputval:0,
222 output_en:0,
223 input_en:1,
224 pullup_en:0,
225 pulldown_en:0,
226 pushpull_en:0,
227 drivestrength:0,
228 opendrain_en:0
229 }};
230 GenericIOType jtag{0}_tdo_io = GenericIOType{{
231 outputval:wrjtag{0}_tdo,
232 output_en:1,
233 input_en:0,
234 pullup_en:0,
235 pulldown_en:0,
236 pushpull_en:0,
237 drivestrength:0,
238 opendrain_en:0
239 }};
240 '''
241
242 pwmwires = '''
243 Wire#(Bit#(1)) wrpwm{0}_pwm<-mkDWire(0);
244 GenericIOType pwm{0}_pwm_io = GenericIOType{{
245 outputval:wrpwm{0}_pwm,
246 output_en:1,
247 input_en:0,
248 pullup_en:0,
249 pulldown_en:0,
250 pushpull_en:0,
251 drivestrength:0,
252 opendrain_en:0
253 }};
254 '''
255 # =================================== #