New DFT Tool: Starting with scan replace
Tool: Design for Test
Subcategory: New tool addition
Conversation
fgaray
Hello OpenROAD devs,
I am planning on contributing a new tool (following https://github.com/The-OpenROAD-Project/OpenROAD/blob/master/docs/contrib/DeveloperGuide.md, I will call this "dft") for DFT insertion into OpenROAD and I would like to discuss the user facing API.
User facing API
I think we should create two new main commands for DFT: preview_dft and insert_dft:
- preview_dft: will show a summary of what scan chains are we going to create (after scan architect) but will not apply any changes to the design. This is an immutable command and will not perform any modifications to the design or database. This is useful for debugging proposes and to help users to iterate any DFT option that could change the creation of the scan chains.
- insert_dft: will run again from scratch the immutable part of preview_dft, including scan architect and perform scan stitching. The result of insert_dft should be the same that the one presented by preview_dft but applied to the design.
I would say that it is better to configure the DFT compiler with commands like "set_dft_*" instead of receiving any argument in "preview_dft" or "insert_dft". For example: set_dft_no_scan (for cells that we don't want to scan replace), set_dft_chain_count (for the number of scan chains to be created) or set_dft_clock_mix (if we want or not to mix clock domains).
Now, I am not sure if this is going to be something you expect to see in the Python interface, this is a very TCL oriented API and I would like to see if you have any suggestion on doing this more programmatically for Python scripting (maybe this is totally fine as we can have a different API for Python?).
Where in the flow is DFT insertion going to be?
Looking into OpenROAD's flow, I think the best part to perform DFT insertion is between "Logic Synthesis" and "Floorplanning". That way we floorplanning will have all the info about DFT to perform optimizations in the design.
Feel free to suggest something different here :).
What is the plan?
For now, I will only be creating "insert_dft" and "set_no_scan" for scan replacement: I will replace sequential cells (excluding black boxes as we don't have support for CTLs yet!) in the design with scan equivalents if they are available and nothing more inside insert_dft. I will keep of of the scope adding scan muxes or any other kind of scan stitching as this is my first approach to OpenROAD.
Please, let me know if there is something I should be aware of or anything related to this idea or the user interface.
Thanks!, Felipe
maliberty
I think it is best to do scan chain after global placement. You want to put the ff in the best placement for timing and only then construct the chain ordering based on neighbors.
It would be helpful to know what commands you intend to implement to define the chains. A small complete example would clarify the use model.
For python API please see the discussion in https://github.com/The-OpenROAD-Project/OpenROAD/discussions/2745
maliberty
@rovinski @msaligane @louiic @Colin-Holehouse any comments?
rovinski
Very cool! Always excited to see more functionality contributed 😃
maliberty
Would you say more about scandef and how you intend to generate it?
maliberty
Note that odb doesn't store any scan information from DEF today so you'll have to plan on enhancing it as part of this project.
maliberty
In case its useful: http://vlsicad.eecs.umich.edu/BK/Slots/cache/vlsicad.ucsd.edu/GSRC/Bookshelf/Slots/ScanOpt/
fgaray
Hey @maliberty ,
I am trying to write a function to perform the scan replace and I need to find a scan equivalent cell in the DB.
I am iterating over the libs in the odb::dbDatabase like this:
bool IsLibScanCell(odb::dbLib* lib) {
for (odb::dbMaster* master: lib->getMasters()) {
for (odb::dbMTerm* mterm: master->getMTerms()) {
std::cout << mterm->getSigType().getString() << std::endl;
}
}
return false;
}
But looks like the enum of getSigType does not have enough information to see if a pin is scan_enable or scan_in. Is this something that I need to implement or is there another way to access this information inside the lib? I see that in sta/ there are some parsing to detect scan signals, but I do not see them being used in any place outside sta/.
fgaray
For scan replace, I have a working demo where I collect the scan lib cells and then I try to iterate over the design's blocks applying "sta::dbNetwork" replaceCell, but I found that this and some methods in sta:: check before performing the replace if both cells are "equivalent" by counting the number of ports in each cell (See inDbInstSwapMasterBefore in dbSta/src/dbSta.cc ).
This is not really true when you try to replace a cell with an scan equivalent because the scan one will have additional ports like scan in and scan enable.
I was wondering if there is a function that I am missing that could help me with this kind of replace.
If not, should I provide a new method for dbSta and odb that checks for functional equivalent ports instead of index/name based matching (See swapMaster in odb/src/db/dbInst.cpp) or roll one myself just for DFT? Would you prefer this method to be available in odb or maybe just complete change the way we do the replaceCell?
Thanks!
fgaray
Hi @maliberty,
Do you know how to test if two ports/pins are functional equivalent?, I am trying to use sta::LibertyPort's function() and sta::FuncExpr::equiv() but looks like sta::LibertyPort's function() returns most of the time nullptr. I see that in odb/src/db/dbInst.cpp:1201, we test that mterms are equivalent by checking that the name of the ports is the same (line 1236).
I can work with that but I think my scan replace function will be more robust if I can check if the ports are functional equivalent.
fgaray
Implemented basic DFT in #2900, #3079 and #3356
