@@ -266,14 +266,62 @@ struct Device {
266
266
constant @1 : ConstantType;
267
267
}
268
268
269
+ # Table lookup map, for string parameters
270
+ struct ParameterMapEntry {
271
+ # If the primitive parameter matches 'from', then the macro
272
+ # instance parameter will be set to 'to'.
273
+ from @0 : StringIdx $stringRef();
274
+ to @1 : StringIdx $stringRef();
275
+ }
276
+
277
+ # This describes how we map a parameter from primitive to its
278
+ # macro expansion.
279
+ struct ParameterMapRule {
280
+ # Name of the parameter in its parent primitive
281
+ primParam @0 : StringIdx $stringRef();
282
+ # Name of the cell instance to set the derived parameter on
283
+ instName @1 : StringIdx $stringRef();
284
+ # Name of the parameter on the cell instance to set
285
+ instParam @2 : StringIdx $stringRef();
286
+ # How to derive the new parameter value
287
+ union {
288
+ # Copy the value directly across with no transform applied
289
+ copyValue @3 : Void;
290
+ # Apply an arbitrary mapping of bits while deriving the new value.
291
+ # Bit i of the derived value will be taken from bit bitSlice[i] of the
292
+ # parent primitive parameter. This way bit ranges; every Nth bit and
293
+ # permutation can all be represented.
294
+ bitSlice @4 : List(UInt32);
295
+ # Use a table lookup to derive a new value for a string parameter.
296
+ tableLookup @5 : List(ParameterMapEntry);
297
+ }
298
+ }
299
+
269
300
# #####################################
270
301
# Macro expansion exception map for
271
302
# primitives that don't expand to a
272
- # macro of the same name.
303
+ # macro of the same name. This is also
304
+ # used for conditional matches on
305
+ # parameter values and parameter
306
+ # transforms from primitive to
307
+ # expansion.
273
308
# #####################################
274
309
struct PrimToMacroExpansion {
275
310
primName @0 : StringIdx $stringRef();
276
311
macroName @1 : StringIdx $stringRef();
312
+ # Optionally, primitive to macro expansions can be conditional on a
313
+ # parameter match. For example, I/O buffer expansions might be
314
+ # different between true and pseudo differential IO types. The
315
+ # expansion is used if **any** of the parameters specified match.
316
+ union {
317
+ always @2 : Void;
318
+ parameters @3 : List(Dir.Netlist.PropertyMap.Entry);
319
+ }
320
+ # These rules are used to map parameters from the primitive to the
321
+ # constituent cell instances for the macro. For example; a LUTRAM
322
+ # primitive might have its init value split up to the init values
323
+ # of its constituent LUTs.
324
+ paramMapping @4 : List(ParameterMapRule);
277
325
}
278
326
279
327
# Cell <-> BEL and Cell pin <-> BEL Pin mapping
0 commit comments