mirror of
https://github.com/YosysHQ/yosys.git
synced 2026-09-05 11:35:20 +02:00
proc_mux: include switch expression location in $eq src
(cherry picked from commit 383daa1eb3)
This commit is contained in:
@@ -242,8 +242,13 @@ struct MuxGenCtx {
|
||||
// create compare cell
|
||||
RTLIL::Cell *eq_cell = mod->addCell(mod->design->twines.add(std::string{stringf("%s_CMP%d", sstr.str(), cmp_wire->width)}), ifxmode ? TW($eqx) : TW($eq));
|
||||
apply_attrs(eq_cell, cs);
|
||||
if (cs->compare_src != Twine::Null)
|
||||
eq_cell->set_src_attribute(cs->compare_src);
|
||||
std::vector<TwineRef> eq_sources;
|
||||
if (sw->signal_src != Twine::Null)
|
||||
eq_sources.push_back(sw->signal_src);
|
||||
if (cs->compare_src != Twine::Null && cs->compare_src != sw->signal_src)
|
||||
eq_sources.push_back(cs->compare_src);
|
||||
if (!eq_sources.empty())
|
||||
eq_cell->set_src_attribute(mod->design->twines.concat(std::span<const TwineRef>{eq_sources}));
|
||||
|
||||
eq_cell->parameters[ID::A_SIGNED] = RTLIL::Const(0);
|
||||
eq_cell->parameters[ID::B_SIGNED] = RTLIL::Const(0);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
read_verilog proc_mux_src.v
|
||||
proc -noopt
|
||||
check -assert
|
||||
# eq refer to the values compared against
|
||||
# eq refer to both sides of the comparison of switch signal vs case value
|
||||
select -assert-count 2 tiny2/t:$eq
|
||||
select -assert-count 1 tiny2/t:$eq a:src=proc_mux_src.v:81.4-81.10 %i
|
||||
select -assert-count 1 tiny2/t:$eq a:src=proc_mux_src.v:84.4-84.10 %i
|
||||
select -assert-count 1 tiny2/t:$eq a:src=proc_mux_src.v:80.9-80.11|proc_mux_src.v:81.4-81.10 %i
|
||||
select -assert-count 1 tiny2/t:$eq a:src=proc_mux_src.v:80.9-80.11|proc_mux_src.v:84.4-84.10 %i
|
||||
# Flops cover the assigned to wire and whole process
|
||||
select -assert-count 1 tiny2/t:$dff
|
||||
select -assert-count 1 tiny2/t:$dff a:src=proc_mux_src.v:76.19-76.22|proc_mux_src.v:78.2-91.5
|
||||
|
||||
Reference in New Issue
Block a user