Skip to content

Commit 12f597d

Browse files
authored
gatemate: propagate clock constraints on input ports (YosysHQ#1497)
1 parent e7f52d1 commit 12f597d

File tree

6 files changed

+27
-10
lines changed

6 files changed

+27
-10
lines changed

himbaechel/uarch/gatemate/bitstream.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ struct BitstreamBackend
154154
{
155155
ChipConfig cc;
156156
cc.chip_name = device;
157-
int bank[9] = { 0 };
157+
int bank[9] = {0};
158158
for (auto &cell : ctx->cells) {
159159
CfgLoc loc = get_config_loc(cell.second.get()->bel.tile);
160160
auto &params = cell.second.get()->params;

himbaechel/uarch/gatemate/pack.cc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,23 @@ void GateMatePacker::remove_not_used()
222222
}
223223
}
224224

225+
void GateMatePacker::copy_constraint(NetInfo *in_net, NetInfo *out_net)
226+
{
227+
if (!in_net || !out_net)
228+
return;
229+
if (ctx->debug)
230+
log_info("copy clock period constraint on net '%s' from net '%s'\n", out_net->name.c_str(ctx),
231+
in_net->name.c_str(ctx));
232+
if (out_net->clkconstr.get() != nullptr)
233+
log_warning("found multiple clock constraints on net '%s'\n", out_net->name.c_str(ctx));
234+
if (in_net->clkconstr) {
235+
out_net->clkconstr = std::unique_ptr<ClockConstraint>(new ClockConstraint());
236+
out_net->clkconstr->low = in_net->clkconstr->low;
237+
out_net->clkconstr->high = in_net->clkconstr->high;
238+
out_net->clkconstr->period = in_net->clkconstr->period;
239+
}
240+
}
241+
225242
void GateMateImpl::pack()
226243
{
227244
const ArchArgs &args = ctx->args;

himbaechel/uarch/gatemate/pack.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ struct GateMatePacker
6565
CellInfo *create_cell_ptr(IdString type, IdString name);
6666
void flush_cells();
6767
void pack_ram_cell(CellInfo &ci, CellInfo *cell, int num, bool is_split);
68+
void copy_constraint(NetInfo *in_net, NetInfo *out_net);
6869

6970
pool<IdString> packed_cells;
7071
std::map<NetInfo *, int> global_signals;

himbaechel/uarch/gatemate/pack_bram.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ uint8_t GateMatePacker::ram_clk_signal(CellInfo *cell, IdString port)
6666
val = 0b00010011;
6767
break;
6868
}
69-
cell->disconnectPort(port);
7069
return val;
7170
}
7271
}

himbaechel/uarch/gatemate/pack_clocking.cc

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,7 @@ void GateMatePacker::pack_bufg()
131131
if (is_cpe_source) {
132132
ci.cluster = ci.name;
133133
}
134-
135-
if (in_net->clkconstr) {
136-
NetInfo *o_net = ci.getPort(id_O);
137-
o_net->clkconstr = std::unique_ptr<ClockConstraint>(new ClockConstraint());
138-
o_net->clkconstr->low = in_net->clkconstr->low;
139-
o_net->clkconstr->high = in_net->clkconstr->high;
140-
o_net->clkconstr->period = in_net->clkconstr->period;
141-
}
134+
copy_constraint(in_net, ci.getPort(id_O));
142135
}
143136
ci.type = id_BUFG;
144137
}

himbaechel/uarch/gatemate/pack_io.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,13 @@ void GateMatePacker::pack_io()
168168
if (ci.type == id_CC_LVDS_TOBUF && !ci.getPort(id_T))
169169
ci.type = id_CC_LVDS_OBUF;
170170

171+
if (ci.type.in(id_CC_IBUF, id_CC_IOBUF))
172+
copy_constraint(ci.getPort(id_I), ci.getPort(id_Y));
173+
if (ci.type.in(id_CC_LVDS_IBUF, id_CC_LVDS_IOBUF)) {
174+
copy_constraint(ci.getPort(id_I_P), ci.getPort(id_Y));
175+
copy_constraint(ci.getPort(id_I_N), ci.getPort(id_Y));
176+
}
177+
171178
std::vector<IdString> keys;
172179
for (auto &p : ci.params) {
173180

0 commit comments

Comments
 (0)