Commit 690978d
committed
copilot-bluespec: Flip direction of interface inputs and outputs in Bluespec. Refs #677.
The current Bluespec backend leads to Verilog code that requires manual
manipulations in order to work correctly. Specifically, Copilot externs, which
are inputs to the Copilot monitoring system, are treated as _outputs_ in
Verilog, and Copilot triggers, which can be considered outputs of the
monitoring system, are treated as _inputs_. This is the opposite of the
interface that we would like users to work with, and of what other backends
generate (e.g., C99).
This commit updates the internals of `copilot-bluespec` to flip the order in
which generated Bluespec module interfaces declare their inputs and outputs. A
module interface now represents each Copilot extern as a method of type `<ty>
-> Action` (where `<ty>` is the type of the extern), as this directly
translates to a Verilog input. Moreover, a module interface now represents
trigger arguments as interface methods of type `<ty>_i`, where each `<ty>_i` is
the type of each trigger argument. Each `<ty>_i` directly translates to a
Verilog output.
In addition to changing the module interface definitions, this also changes the
generated modules that instantiate the new interfaces. One of the more notable
changes is that all extern values are stored as a Bluespec `Wire` in the module
internals, as this leads to compact Verilog code without adding any
user-visible inputs or outputs. Every time a value is read from an extern, the
corresponding `Wire` must be read from, which means that several parts of the
module internals have been updated to reference these `Wire`s.1 parent 2f8ae35 commit 690978d
File tree
3 files changed
+136
-31
lines changed- copilot-bluespec/src/Copilot/Compile/Bluespec
3 files changed
+136
-31
lines changedLines changed: 117 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | | - | |
| 21 | + | |
19 | 22 | | |
| 23 | + | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
| 27 | + | |
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
| |||
50 | 55 | | |
51 | 56 | | |
52 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
53 | 68 | | |
54 | 69 | | |
55 | 70 | | |
| |||
133 | 148 | | |
134 | 149 | | |
135 | 150 | | |
136 | | - | |
137 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
138 | 181 | | |
139 | 182 | | |
140 | | - | |
| 183 | + | |
141 | 184 | | |
142 | 185 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
148 | 193 | | |
149 | | - | |
| 194 | + | |
150 | 195 | | |
151 | 196 | | |
152 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
153 | 230 | | |
154 | | - | |
| 231 | + | |
| 232 | + | |
155 | 233 | | |
156 | 234 | | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
157 | 238 | | |
158 | 239 | | |
159 | 240 | | |
160 | 241 | | |
161 | | - | |
162 | | - | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
163 | 245 | | |
164 | | - | |
| 246 | + | |
165 | 247 | | |
166 | 248 | | |
| 249 | + | |
167 | 250 | | |
168 | 251 | | |
169 | | - | |
170 | | - | |
| 252 | + | |
| 253 | + | |
171 | 254 | | |
172 | | - | |
173 | | - | |
| 255 | + | |
| 256 | + | |
174 | 257 | | |
175 | 258 | | |
176 | 259 | | |
| |||
238 | 321 | | |
239 | 322 | | |
240 | 323 | | |
241 | | - | |
| 324 | + | |
242 | 325 | | |
243 | | - | |
244 | | - | |
245 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
246 | 330 | | |
247 | 331 | | |
248 | | - | |
| 332 | + | |
249 | 333 | | |
250 | 334 | | |
251 | 335 | | |
| |||
260 | 344 | | |
261 | 345 | | |
262 | 346 | | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | 54 | | |
56 | | - | |
57 | | - | |
58 | | - | |
| 55 | + | |
59 | 56 | | |
60 | 57 | | |
61 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
| |||
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
44 | | - | |
45 | | - | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
49 | 55 | | |
50 | 56 | | |
51 | 57 | | |
| |||
86 | 92 | | |
87 | 93 | | |
88 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
89 | 104 | | |
90 | 105 | | |
91 | 106 | | |
| |||
0 commit comments