mirror of
https://github.com/YosysHQ/yosys
synced 2026-04-28 06:43:37 +00:00
Merge pull request #5610 from nataliakokoromyti/upstream-debugon
Add debugon pass for persistent debug logging
This commit is contained in:
commit
317a4d77c7
2 changed files with 44 additions and 1 deletions
|
|
@ -115,16 +115,45 @@ struct DebugPass : public Pass {
|
||||||
log("\n");
|
log("\n");
|
||||||
log("Execute the specified command with debug log messages enabled\n");
|
log("Execute the specified command with debug log messages enabled\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
|
log(" debug -on\n");
|
||||||
|
log(" debug -off\n");
|
||||||
|
log("\n");
|
||||||
|
log("Enable or disable debug log messages globally\n");
|
||||||
|
log("\n");
|
||||||
}
|
}
|
||||||
void execute(std::vector<std::string> args, RTLIL::Design *design) override
|
void execute(std::vector<std::string> args, RTLIL::Design *design) override
|
||||||
{
|
{
|
||||||
size_t argidx;
|
size_t argidx;
|
||||||
|
bool mode_on = false;
|
||||||
|
bool mode_off = false;
|
||||||
|
|
||||||
for (argidx = 1; argidx < args.size(); argidx++)
|
for (argidx = 1; argidx < args.size(); argidx++)
|
||||||
{
|
{
|
||||||
// .. parse options ..
|
if (args[argidx] == "-on") {
|
||||||
|
mode_on = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (args[argidx] == "-off") {
|
||||||
|
mode_off = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mode_on && mode_off)
|
||||||
|
log_cmd_error("Cannot specify both -on and -off\n");
|
||||||
|
|
||||||
|
if (mode_on) {
|
||||||
|
log_force_debug++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode_off) {
|
||||||
|
if (log_force_debug > 0)
|
||||||
|
log_force_debug--;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
log_force_debug++;
|
log_force_debug++;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
14
tests/various/debugon.ys
Normal file
14
tests/various/debugon.ys
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
# Test debug -on/-off modes
|
||||||
|
|
||||||
|
design -reset
|
||||||
|
|
||||||
|
read_verilog <<EOT
|
||||||
|
module top(input a, input b, output y);
|
||||||
|
assign y = a & b;
|
||||||
|
endmodule
|
||||||
|
EOT
|
||||||
|
|
||||||
|
debug -on
|
||||||
|
hierarchy
|
||||||
|
select -assert-count 1 t:$and
|
||||||
|
debug -off
|
||||||
Loading…
Add table
Add a link
Reference in a new issue