mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-07 18:05:24 +00:00
extract_counter: Allow forbidding async reset
This commit is contained in:
parent
7b922c0d89
commit
508f1ff6a1
|
@ -111,6 +111,7 @@ struct CounterExtractionSettings
|
||||||
pool<RTLIL::IdString>& parallel_cells;
|
pool<RTLIL::IdString>& parallel_cells;
|
||||||
int maxwidth;
|
int maxwidth;
|
||||||
int minwidth;
|
int minwidth;
|
||||||
|
bool allow_arst;
|
||||||
};
|
};
|
||||||
|
|
||||||
//attempt to extract a counter centered on the given adder cell
|
//attempt to extract a counter centered on the given adder cell
|
||||||
|
@ -241,6 +242,9 @@ int counter_tryextract(
|
||||||
extract.has_reset = false;
|
extract.has_reset = false;
|
||||||
else if(count_reg->type == ID($adff))
|
else if(count_reg->type == ID($adff))
|
||||||
{
|
{
|
||||||
|
if (!settings.allow_arst)
|
||||||
|
return 25;
|
||||||
|
|
||||||
extract.has_reset = true;
|
extract.has_reset = true;
|
||||||
|
|
||||||
//Check polarity of reset - we may have to add an inverter later on!
|
//Check polarity of reset - we may have to add an inverter later on!
|
||||||
|
@ -395,7 +399,7 @@ void counter_worker(
|
||||||
//Do nothing, unless extraction was forced in which case give an error
|
//Do nothing, unless extraction was forced in which case give an error
|
||||||
if(reason != 0)
|
if(reason != 0)
|
||||||
{
|
{
|
||||||
static const char* reasons[25]=
|
static const char* reasons[]=
|
||||||
{
|
{
|
||||||
"no problem", //0
|
"no problem", //0
|
||||||
"counter is too large/small", //1
|
"counter is too large/small", //1
|
||||||
|
@ -421,7 +425,8 @@ void counter_worker(
|
||||||
"Underflow value is not equal to init value", //21
|
"Underflow value is not equal to init value", //21
|
||||||
"RESERVED, not implemented", //22, kept for compatibility but not used anymore
|
"RESERVED, not implemented", //22, kept for compatibility but not used anymore
|
||||||
"Reset is not to zero or COUNT_TO", //23
|
"Reset is not to zero or COUNT_TO", //23
|
||||||
"Clock enable configuration is unsupported" //24
|
"Clock enable configuration is unsupported", //24
|
||||||
|
"Async reset used but not permitted" //25
|
||||||
};
|
};
|
||||||
|
|
||||||
if(force_extract)
|
if(force_extract)
|
||||||
|
@ -579,6 +584,9 @@ struct ExtractCounterPass : public Pass {
|
||||||
log(" -minwidth N\n");
|
log(" -minwidth N\n");
|
||||||
log(" Only extract counters at least N bits wide (default 2)\n");
|
log(" Only extract counters at least N bits wide (default 2)\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
|
log(" -allow_arst yes|no\n");
|
||||||
|
log(" Allow counters to have async reset (default yes)\n");
|
||||||
|
log("\n");
|
||||||
log(" -pout X,Y,...\n");
|
log(" -pout X,Y,...\n");
|
||||||
log(" Only allow parallel output from the counter to the listed cell types\n");
|
log(" Only allow parallel output from the counter to the listed cell types\n");
|
||||||
log(" (if not specified, parallel outputs are not restricted)\n");
|
log(" (if not specified, parallel outputs are not restricted)\n");
|
||||||
|
@ -595,6 +603,7 @@ struct ExtractCounterPass : public Pass {
|
||||||
.parallel_cells = _parallel_cells,
|
.parallel_cells = _parallel_cells,
|
||||||
.maxwidth = 64,
|
.maxwidth = 64,
|
||||||
.minwidth = 2,
|
.minwidth = 2,
|
||||||
|
.allow_arst = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
size_t argidx;
|
size_t argidx;
|
||||||
|
@ -635,6 +644,12 @@ struct ExtractCounterPass : public Pass {
|
||||||
settings.minwidth = atoi(args[++argidx].c_str());
|
settings.minwidth = atoi(args[++argidx].c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args[argidx] == "-allow_arst" && argidx+1 < args.size())
|
||||||
|
{
|
||||||
|
settings.allow_arst = args[++argidx] == "yes";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
extra_args(args, argidx, design);
|
extra_args(args, argidx, design);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue