mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-13 04:28:18 +00:00
Drop keep=0 attributes on SB_CARRY
This commit is contained in:
parent
a7e0cca480
commit
946d5854c0
|
@ -51,6 +51,9 @@ void create_ice40_wrapcarry(ice40_wrapcarry_pm &pm)
|
||||||
cell->setParam("\\LUT", st.lut->getParam("\\LUT_INIT"));
|
cell->setParam("\\LUT", st.lut->getParam("\\LUT_INIT"));
|
||||||
|
|
||||||
cell->attributes = std::move(st.carry->attributes);
|
cell->attributes = std::move(st.carry->attributes);
|
||||||
|
auto it = cell->attributes.find(ID::keep);
|
||||||
|
if (it != cell->attributes.end() && !it->second.as_bool())
|
||||||
|
cell->attributes.erase(it);
|
||||||
cell->attributes.insert(st.lut->attributes.begin(), st.lut->attributes.end());
|
cell->attributes.insert(st.lut->attributes.begin(), st.lut->attributes.end());
|
||||||
|
|
||||||
pm.autoremove(st.carry);
|
pm.autoremove(st.carry);
|
||||||
|
@ -69,6 +72,11 @@ struct Ice40WrapCarryPass : public Pass {
|
||||||
log("into an internal $__ICE40_CARRY_WRAPPER cell for preservation across technology\n");
|
log("into an internal $__ICE40_CARRY_WRAPPER cell for preservation across technology\n");
|
||||||
log("mapping.");
|
log("mapping.");
|
||||||
log("\n");
|
log("\n");
|
||||||
|
log("Attributes on both cells will be merged, with SB_CARRY attributes having priority\n");
|
||||||
|
log("over SB_LUT4 attributes, except when (* keep *) attributes present on the SB_CARRY4\n");
|
||||||
|
log("that logically evaluate to false will be dropped (thus allowing the keep attribute,\n");
|
||||||
|
log("if any, on the SB_LUT4 to be adopted).\n");
|
||||||
|
log("\n");
|
||||||
}
|
}
|
||||||
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,7 @@ select -assert-count 1 t:$__ICE40_CARRY_WRAPPER
|
||||||
design -reset
|
design -reset
|
||||||
read_verilog <<EOT
|
read_verilog <<EOT
|
||||||
module top(input A, B, CI, output O, CO);
|
module top(input A, B, CI, output O, CO);
|
||||||
(* foo = "bar", answer = 42 *)
|
(* foo = "bar", answer = 42, keep=0 *)
|
||||||
SB_CARRY carry (
|
SB_CARRY carry (
|
||||||
.I0(A),
|
.I0(A),
|
||||||
.I1(B),
|
.I1(B),
|
||||||
|
@ -47,6 +47,6 @@ EOT
|
||||||
ice40_wrapcarry
|
ice40_wrapcarry
|
||||||
select -assert-count 1 t:$__ICE40_CARRY_WRAPPER
|
select -assert-count 1 t:$__ICE40_CARRY_WRAPPER
|
||||||
select -assert-count 0 t:* t:$__ICE40_CARRY_WRAPPER %d
|
select -assert-count 0 t:* t:$__ICE40_CARRY_WRAPPER %d
|
||||||
select -assert-count 1 a:foo=bar a:answer=42 %i a:keep %i a:blah=blah %i
|
select -assert-count 1 a:foo=bar a:answer=42 %i a:keep=1 %i a:blah=blah %i
|
||||||
techmap -map +/ice40/cells_map.v
|
techmap -map +/ice40/cells_map.v
|
||||||
#TODO: Check unwrapped attributes
|
#TODO: Check unwrapped attributes
|
||||||
|
|
Loading…
Reference in a new issue