hierarchical flow w/ place_macro() #893
-
Hi everyone, I am looking for some guidance on correctly using the place macro function. Specifically more information on choosing the correct instance and module name. Are there any good examples other than the floorplaning tutorial to demonstrate the usage of place_macro() function? I have successfully placed macros from the zerosoc example with this function on a top level Floorplan. However, my goal is to execute a hierarchical flow first with the basic steps:
Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi, good question! The full ZeroSoC build script does something like this, but there's a lot going on there. Here's a minimal example that should help demonstrate the key parts: asic_core.v - the child design module asic_core();
// Insert implementation here
endmodule asic_top.v - the larger design that integrates asic_core module asic_top();
asic_core myinstance ();
// Additional implementation here
endmodule asic_core.bb.v - a blackboxed asic_core.v (you'll see the reason for this shortly) (* blackbox *)
module asic_core(
// instantiate same IO as in asic_core.v
);
// no implementation, this is a blackbox!
endmodule build_core.py - build script for asic_core import siliconcompiler
from siliconcompiler.floorplan import Floorplan
import shutil
chip = siliconcompiler.Chip()
chip.set('design', 'asic_core')
chip.load_target('skywater130_demo')
# Set up sources and anything else
chip.add('source', 'asic_core.v')
# ...
fp = Floorplan(chip)
# Set up floorplan here...
# Generate a DEF and LEF for design
fp.write_def('asic_core.def')
fp.write_lef('asic_core.lef')
# Feed generated DEF into floorplanning step
chip.set('read', 'def', 'floorplan', '0', 'asic_core.def')
# Run build
chip.run()
# Copy generated files out of build directory into current working directory
gds = chip.find_result('gds', step='export')
netlist = chip.find_result('vg', step='dfm')
shutil.copy(gds, 'asic_core.gds')
shutil.copy(netlist, 'asic_core.vg') build_top.py - build script for asic_top import siliconcompiler
from siliconcompiler.floorplan import Floorplan
chip = siliconcompiler.Chip()
chip.set('design', 'asic_top')
chip.load_target('skywater130_demo')
chip.add('source', 'asic_top.v')
# Here is where we need the black-box Verilog module for macro.
chip.add('source', 'asic_core.bb.v')
# ...anything else here
# Before floorplanning, we need to set up the child design as a library.
# This is where we specify the paths to the LEF, GDS, and vg.
chip.add('asic', 'macrolib', 'asic_core')
stackup = chip.get('asic', 'stackup')
chip.set('library', 'asic_core', 'lef', stackup, 'asic_core.lef')
chip.set('library', 'asic_core', 'gds', stackup, 'asic_core.gds')
chip.set('library', 'asic_core', 'netlist', 'verilog', 'asic_core.vg')
fp = Floorplan(chip)
# Place asic_core in asic_top. Note: the instance name needs to match the name of the
# asic_core instance in asic_top.v, and the module name matches the name of the
# asic_core module itself.
fp.place_macros([('myinstance', 'asic_core')], ...)
# Additional floorplanning here...
fp.write_def('asic_top.def')
chip.set('read', 'def', 'floorplan', '0', 'asic_top.def')
chip.run() Importantly, running
I hope this is helpful, let me know if you have any questions about this or if anything comes up. Good luck! |
Beta Was this translation helpful? Give feedback.
Hi, good question! The full ZeroSoC build script does something like this, but there's a lot going on there. Here's a minimal example that should help demonstrate the key parts:
asic_core.v - the child design
asic_top.v - the larger design that integrates asic_core
asic_core.bb.v - a blackboxed asic_core.v (you'll see the reason for this shortly)
build_core.py - build script for asic_core
import