Saar 建议您使用 LUT6 显式实例化 LUT。我更喜欢使用 LUT_MAP 约束来控制技术映射。它需要较少的维护,并且您的 HDL 代码保持与设备无关且对模拟器友好。
这是一个例子。
(* LUT_MAP="yes" *)
module mux4(sel, a, b, c, d, o);
input [1:0] sel;
input a;
input b;
input c;
input d;
output reg o;
always @* begin
case(sel)
2'b00: o <= a;
2'b01: o <= b;
2'b10: o <= c;
2'b11: o <= d;
endcase
end
endmodule
这使您可以编写任意组合逻辑并告诉综合 (XST) 这个(最多 6 个输入,一个输出)模块必须在单个 LUT 中实现。如果将其与 KEEP_HIERARCHY 和 RLOC 约束结合使用,则可以构建 RPM(关系放置的宏)。
(* KEEP_HIERARCHY="true" *)
module mux4x4p4(sel, a, b, c, d, o);
input [1:0] sel;
input [3:0] a;
input [3:0] b;
input [3:0] c;
input [3:0] d;
output [3:0] o;
(* RLOC="X0Y0" *)
mux4 m0(sel, a[0], b[0], c[0], d[0], o[0]);
(* RLOC="X0Y0" *)
mux4 m1(sel, a[1], b[1], c[1], d[1], o[1]);
(* RLOC="X0Y0" *)
mux4 m2(sel, a[2], b[2], c[2], d[2], o[2]);
(* RLOC="X0Y0" *)
mux4 m3(sel, a[3], b[3], c[3], d[3], o[3]);
endmodule
在我的旧网站 www.fpgacpu.org 上有更多关于数据路径 RPM 的信息。例如,高性能 FPGA 设计的艺术:http ://www.fpgacpu.org/log/aug02.html#art
快乐黑客!