-
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?
Conversation
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.
clang-tidy made some suggestions
680b23b
to
384887b
Compare
6af52bc
to
a9ff57d
Compare
245cca5
to
c3c3a60
Compare
@maliberty When you have a chance… |
dft.one_cell_sky130.tcl failed in pr-merge. I recently updated that test so you might need to merge master and check it. |
@fgaray please review if you have a chance. |
This changeset makes the DFT module a bit more flexible. The highlights are new ports don't have to be punched- you can connect to any existing ITerm or BTerm and new ports are only punched as a fallback. Additionally, the scan chain order can be written in a JSON format so it may be consumed by other utilities. --- * dft::Dft::insertDft: Add capability for per-chain enable, ability to provide runtime format strings for scan enable/in/out patterns * dft::ScanStitch: * if a name pattern includes an un-escaped forward slash (/), steps are to attempt to find an existing ITerm instead of creating a new BTerm * else, if a BTerm already exists, the BTerm is reused. * finally, a new BTerm is created. * dft::Dft: create writeScanChains, which writes the scan chains (currently just names and ordering of flip-flops) in JSON format. Allows data to be passed to other DFT utilities. * dft: create ResetDomain, which encapsulates reset domains similar to how dft::ClockDomain encapsulates clock domains. currently unused --- There is one breaking change, which is that scan_enable_{}/scan_in_{}/ etc are numbered starting from 0 instead of 1. The rationale is the chains themselves are numbered starting from 0 and there appears to be no good justification to start them from 1. Otherwise, tests will (hopefully) show this PR as fully backwards-compatible. Signed-off-by: Mohamed Gaber <[email protected]>
Signed-off-by: Mohamed Gaber <[email protected]>
Signed-off-by: Mohamed Gaber <[email protected]>
lgtm but I'll wait a bit to merge in case @fgaray wants to comment. |
Checking now |
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.
Thanks for your contribution!
Some questions that I have:
- For the per chain enable, what is the use case?, Usually we have only one scan enable and the way we control different scan chains is by a test mode port. We don't have an implementation currently but I will be happy to help you design one if you want.
- writeScanChains: Do you have a list of other DFT tools that could consume this format? The standard for sharing scan data is the scan def formats.
- What are reset domains about? The scan chain only cares if data can be shifted in, that's why the clock is important so we know how to order them from falling edge -> rising edge. The reset does not play a role in shifting. I may be missing something here but happy to discuss.
Thanks!
High = 1, // active high | ||
}; | ||
|
||
class ResetDomain |
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.
Could you please add a comment explaining what the reset domain is about and why we need it?
} | ||
|
||
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 comment
The 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.
root.add_child(chain->getName(), current_chain); | ||
} | ||
|
||
boost::property_tree::write_json(json_file, root); |
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.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see this being used anywhere. Please remove.
} | ||
|
||
ScanDriver ScanStitch::FindOrCreateScanEnable(odb::dbBlock* block) | ||
static std::pair<std::string, std::optional<std::string>> split_term_identifier( |
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.
Use an anonymous namespace instead of static: https://abseil.io/tips/186
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.
Also, please rename this to be consistent with the rest of the file: SplitTermIdentitifer
{ | ||
// TODO: For now we will create a new scan_out pin at the top level if we need | ||
// one. We need to support defining DFT signals for scan_out | ||
const char* kind = "scan-out"; |
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.
Declare a constant on this file to hold this. https://abseil.io/tips/140
Something like "constexpr std::string_view kKind = "scan-out"; " with a more appropriated name.
// TODO: For now we will create a new scan_out pin at the top level if we need | ||
// one. We need to support defining DFT signals for scan_out | ||
const char* kind = "scan-out"; | ||
auto term_info = split_term_identifier(with_name, kind, logger); |
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.
Try to minimize the usage of auto: https://abseil.io/tips/232
explicit ScanStitch(odb::dbDatabase* db); | ||
explicit ScanStitch(odb::dbDatabase* db, | ||
bool per_chain_enable, | ||
std::string scan_enable_name_pattern = "scan_enable_{}", |
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.
If you create the ScanStitchConfig class, then you can add the default values there instead of adding them here.
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.
Note that per_chain_enable could also be a config set in that ScanStitchConfig class
|
||
// Stitch all the cells inside each one of the scan chains together. | ||
void Stitch(const std::vector<std::unique_ptr<ScanChain>>& scan_chains); | ||
void Stitch(const std::vector<std::unique_ptr<ScanChain>>& scan_chains, | ||
utl::Logger* logger); |
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.
All of these member functions are receiving logger, I would suggest instead to pass it in the constructor and hold a pointer to it.
void Stitch(odb::dbBlock* block, | ||
const ScanChain& scan_chain, | ||
const ScanDriver& scan_enable); | ||
utl::Logger* logger, | ||
size_t ordinal = 1, |
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 ordinal doing here? Please add a comment. Thanks!
This changeset makes the DFT module a bit more flexible.
The highlights are new ports don't have to be punched- you can connect to any existing ITerm or BTerm and new ports are only punched as a fallback. Additionally, the scan chain order can be written in a JSON format so it may be consumed by other utilities.
There is one breaking change, which is that scan_enable_{}/scan_in_{}/ etc are numbered starting from 0 instead of 1. The rationale is the chains themselves are numbered starting from 0 and there appears to be no good justification to start them from 1. Otherwise, tests will (hopefully) show this PR as fully backwards-compatible.