-
Notifications
You must be signed in to change notification settings - Fork 581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dft: per-chain enables, user-configurable name patterns #6412
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ TAGS | |
.cache | ||
Makefile | ||
__pycache__ | ||
venv/ | ||
|
||
include/ord/Version.hh | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,8 @@ | |
|
||
#include "dft/Dft.hh" | ||
|
||
#include <boost/property_tree/json_parser.hpp> | ||
#include <boost/property_tree/ptree.hpp> | ||
#include <iostream> | ||
|
||
#include "ClockDomain.hh" | ||
|
@@ -104,15 +106,59 @@ void Dft::scanReplace() | |
scan_replace_->scanReplace(); | ||
} | ||
|
||
void Dft::insertDft() | ||
void Dft::writeScanChains(const std::string& filename) | ||
{ | ||
using boost::property_tree::ptree; | ||
if (need_to_run_pre_dft_) { | ||
pre_dft(); | ||
} | ||
|
||
std::ofstream json_file(filename); | ||
if (!json_file.is_open()) { | ||
logger_->error( | ||
utl::DFT, 13, "Failed to open file {} for writing.", filename); | ||
} | ||
try { | ||
ptree root; | ||
|
||
std::vector<std::unique_ptr<ScanChain>> scan_chains = scanArchitect(); | ||
|
||
for (auto& chain : scan_chains) { | ||
ptree current_chain; | ||
ptree cells; | ||
auto& scan_cells = chain->getScanCells(); | ||
for (auto& cell : scan_cells) { | ||
ptree name; | ||
name.put("", cell->getName()); | ||
cells.push_back(std::make_pair("", name)); | ||
} | ||
current_chain.add_child("cells", cells); | ||
root.add_child(chain->getName(), current_chain); | ||
} | ||
|
||
boost::property_tree::write_json(json_file, root); | ||
} catch (std::exception& ex) { | ||
logger_->error( | ||
utl::DFT, 14, "Failed to write JSON report. Exception: {}", ex.what()); | ||
} | ||
} | ||
|
||
void Dft::insertDft(bool per_chain_enable, | ||
const std::string& scan_enable_name_pattern, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, add those patterns arguments to DftConfig.hh. You can even create a new class for stitching options like "ScanStitchConfig" to hold them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Working on it… |
||
const std::string& scan_in_name_pattern, | ||
const std::string& scan_out_name_pattern) | ||
{ | ||
if (need_to_run_pre_dft_) { | ||
pre_dft(); | ||
} | ||
std::vector<std::unique_ptr<ScanChain>> scan_chains = scanArchitect(); | ||
|
||
ScanStitch stitch(db_); | ||
stitch.Stitch(scan_chains); | ||
ScanStitch stitch(db_, | ||
per_chain_enable, | ||
scan_enable_name_pattern, | ||
donn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
scan_in_name_pattern, | ||
donn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
scan_out_name_pattern); | ||
donn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
stitch.Stitch(scan_chains, logger_); | ||
} | ||
|
||
DftConfig* Dft::getMutableDftConfig() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,6 +85,9 @@ class ScanChain | |
// Returns the name of the scan chain | ||
const std::string& getName() const; | ||
|
||
// Changes the name of the scan chain | ||
void rename(std::string& new_name); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see this being used anywhere. Please remove. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure |
||
|
||
private: | ||
std::string name_; | ||
std::vector<std::unique_ptr<ScanCell>> rising_edge_scan_cells_; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the use case for writing the scan chains into a json?
If you want to provide a command like that, I would suggest to store the created scan chains after insertDft into odb (see the test here: odb/test/cpp/scan/TestScanChain.cpp)
Later in your write json command, you can read that dbScanChain and write the information out, otherwise you will be running architect again on a potentially already scan stitched design.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a utility that uses that JSON file and ATPG results to create test vectors. I was operating under the assumption that ScanArchitect is a function of the current placement data (and thus re-entrant), so that's why I didn't bother storing its result.
I suppose this would be the more "correct" way to do it, but I'd have to get the extra time authorized to both do this and expose the appropriate data in libopenroad so the utility can consume the data from storage instead (or integrate a DEF parser into the utility)