Skip to content

Commit e714e59

Browse files
committed
Added "is_inferred" attribute to all inferred k6n10f DSPs to distinguish them from manually inserted ones.
Signed-off-by: Maciej Kurc <[email protected]>
1 parent 52cdcc4 commit e714e59

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

ql-qlf-plugin/ql-dsp-io-regs.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ struct QlDspIORegs : public Pass {
8282
std::string cell_type = cell.second->type.str();
8383
if (cell_type == RTLIL::escape_id("QL_DSP2") || cell_type == RTLIL::escape_id("QL_DSP3")) {
8484
auto dsp = cell.second;
85+
86+
// If the cell does not have the "is_inferred" attribute set
87+
// then don't touch it.
88+
if (!dsp->has_attribute(RTLIL::escape_id("is_inferred")) ||
89+
dsp->get_bool_attribute(RTLIL::escape_id("is_inferred")) == false)
90+
{
91+
continue;
92+
}
93+
8594
bool del_clk = true;
8695
bool use_dsp_cfg_params = (cell_type == RTLIL::escape_id("QL_DSP3"));
8796

ql-qlf-plugin/ql-dsp-macc.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ static void create_ql_macc_dsp(ql_dsp_macc_pm &pm)
131131
// Add the DSP cell
132132
RTLIL::Cell *cell = pm.module->addCell(RTLIL::escape_id(name), type);
133133

134+
// Set attributes
135+
cell->set_bool_attribute(RTLIL::escape_id("is_inferred"), true);
136+
134137
// Get input/output data signals
135138
RTLIL::SigSpec sig_a;
136139
RTLIL::SigSpec sig_b;

ql-qlf-plugin/ql-dsp-simd.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,16 @@ struct QlDspSimdPass : public Pass {
261261
simd->setParam(RTLIL::escape_id("MODE_BITS"), RTLIL::Const(mode_bits));
262262
log_assert(mode_bits.size() == mode_bits_size);
263263

264+
// Handle the "is_inferred" attribute. If one of the fragments
265+
// is not inferred mark the whole DSP as not inferred
266+
bool is_inferred_a = dsp_a->has_attribute(RTLIL::escape_id("is_inferred")) ?
267+
dsp_a->get_bool_attribute(RTLIL::escape_id("is_inferred")) : false;
268+
bool is_inferred_b = dsp_b->has_attribute(RTLIL::escape_id("is_inferred")) ?
269+
dsp_b->get_bool_attribute(RTLIL::escape_id("is_inferred")) : false;
270+
271+
simd->set_bool_attribute(RTLIL::escape_id("is_inferred"),
272+
is_inferred_a && is_inferred_b);
273+
264274
// Mark DSP parts for removal
265275
cellsToRemove.push_back(dsp_a);
266276
cellsToRemove.push_back(dsp_b);

ql-qlf-plugin/qlf_k6n10f/dsp_map.v

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ module \$__QL_MUL20X18 (input [19:0] A, input [17:0] B, output [37:0] Y);
3434
{{(18 - B_WIDTH){1'b0}}, B};
3535

3636
generate if (`USE_DSP_CFG_PARAMS == 0) begin
37+
(* is_inferred=1 *)
3738
dsp_t1_20x18x64_cfg_ports _TECHMAP_REPLACE_ (
3839
.a_i (a),
3940
.b_i (b),
@@ -53,6 +54,7 @@ module \$__QL_MUL20X18 (input [19:0] A, input [17:0] B, output [37:0] Y);
5354
.register_inputs_i (1'b0)
5455
);
5556
end else begin
57+
(* is_inferred=1 *)
5658
dsp_t1_20x18x64_cfg_params #(
5759
.OUTPUT_SELECT (3'd0),
5860
.SATURATE_ENABLE (1'b0),
@@ -98,6 +100,7 @@ module \$__QL_MUL10X9 (input [9:0] A, input [8:0] B, output [18:0] Y);
98100
{{( 9 - B_WIDTH){1'b0}}, B};
99101

100102
generate if (`USE_DSP_CFG_PARAMS == 0) begin
103+
(* is_inferred=1 *)
101104
dsp_t1_10x9x32_cfg_ports _TECHMAP_REPLACE_ (
102105
.a_i (a),
103106
.b_i (b),
@@ -117,6 +120,7 @@ module \$__QL_MUL10X9 (input [9:0] A, input [8:0] B, output [18:0] Y);
117120
.register_inputs_i (1'b0)
118121
);
119122
end else begin
123+
(* is_inferred=1 *)
120124
dsp_t1_10x9x32_cfg_params #(
121125
.OUTPUT_SELECT (3'd0),
122126
.SATURATE_ENABLE (1'b0),

0 commit comments

Comments
 (0)