You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[hw/prim] Addition of prim_sdc_example for constraints checking
The module prim_sdc_example has been added to the prim repository. The
functionality of this block is irrelevant. It is only needed to run a
basic synthesis on a simplified design such that it can be verified that
all important synthesis constraints to preserve instances and prevent
logic optimization across preserved instances are applied correctly.
Signed-off-by: Michael Gautschi <[email protected]>
Copy file name to clipboardExpand all lines: hw/ip/prim/README.md
+57-1Lines changed: 57 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -247,7 +247,7 @@ To create a technology library follow these steps:
247
247
`mytech`will be used as a placeholder name in the examples.
248
248
2. Create a directory in `hw/ip` with the prefix `prim_` followed by the name of your technology library.
249
249
3. Copy `hw/ip/prim_generic/prim_generic.core` into the new directory renaming it to match your primitive library, e.g. `hw/ip/prim_mytech/prim_mytech.core`
250
-
Change the vendor and name in this file, e.g. `lowrisc:prim_generic` would become `partner:mytech` where your organisation's name can be used in the place of 'partner'.
250
+
Change the vendor and name in this file, e.g. `lowrisc:prim_generic` would become `partner:prim_mytech` where your organisation's name can be used in the place of 'partner'.
251
251
Also, edit the description to better describe the specific implementation.
252
252
4. For every primitive implemented by your library:
253
253
1. Copy across the generic implementation into your library, e.g. `cp hw/ip/prim_generic/rtl/prim_flop.sv hw/ip/prim_mytech/rtl/prim_flop.sv`.
@@ -310,3 +310,59 @@ fusesoc \
310
310
--mapping partner:prim_mytech:all \ # Select alternate implementation via mappings
311
311
lowrisc:systems:chip_earlgrey_asic
312
312
```
313
+
### prim_asap7 example
314
+
315
+
[ASAP7](https://github.com/The-OpenROAD-Project/asap7) is an open-source standard-cell library.
316
+
It serves as an example for partners to integrate their own technology specific prim library.
317
+
318
+
The steps in [creating a tech library](#creating-a-technology-library) were followed to create this prim library.
319
+
320
+
Each standard-cell instance name is prefixed with a `u_size_only_` such that these instances can be easily identified during synthesis and preserved.
321
+
322
+
### Important synthesis constraints to keep important redundant constructs
323
+
324
+
The basic prim instances cannot be removed or merged with other cells through logic optimization or constant propagation as this would remove important security countermeasures from the design.
325
+
326
+
All instantiated basic gates (`buf`, `mux2`, `inv`, `clock_gating`, `and2`, `xor2`, `xnor2`, `flop`) should be instantiated with a name prefix of `u_size_only_` such that preserve attributes can be set during synthesis.
327
+
The syntax to set a preserved attribute varies across tool providers.
328
+
To make sure the right constraints are applied, a simple example design (`prim_sdc_example`) is provided.
329
+
This design can be synthesized, and its netlist can be analyzed to verify that the correct constraints are applied and all important cells are preserved.
330
+
331
+
The required files for synthesis can be generated with the following command:
332
+
333
+
```shell
334
+
fusesoc --cores-root . \
335
+
run \
336
+
--target=syn \
337
+
--flag fileset_partner \
338
+
--mapping lowrisc:prim_asap7:all \
339
+
--setup \
340
+
--build-root build lowrisc:prim:sdc_example
341
+
```
342
+
343
+
By setting the `fileset_partner` flag, the generic prim implementation is not used, and the one provided through the mapping argument is used instead.
344
+
Please note, on designs with other technology dependent files, the `fileset_partner` flag also selects other technology specific implementations (e.g. OTP, Flash, JTAG, AST, pads).
345
+
If those are not used, they can be mapped to the generic implementations.
346
+
347
+
#### Checks on the generated netlist
348
+
349
+
After synthesizing the top module `prim_sdc_example` the following checks should be performed on the netlist:
350
+
351
+
1. In the synthesized netlist, the following number of size_only instances must be present:
2. None of the test_*_o signals can be driven by a constant 0 or 1.
358
+
The instantiated `size_only` instances must prevent logic optimizations and keep the output comparators.
359
+
This can be checked with the synthesis tool, e.g. `check_design -constant`
360
+
361
+
3. None of the buffers or flip flops in this example design are unloaded if constraints are applied correctly.
362
+
This can be checked by the synthesis tool, e.g. `check_design -unloaded_comb/-unloaded_seqs`
363
+
364
+
4. `lc_en_o`, `mubi_o` signals cannot be driven to a constant value because optimization or constant propagation across preserved instances is not allowed.
365
+
366
+
5. `lc_en_i`, `mubi_i` signals can only be connected to variables, or legal values (`MuBi4True`, `MuBi4False`, `On`, `Off`)
367
+
368
+
If all checks are successful, the same constraints can be applied to the full design.
0 commit comments