【发布时间】:2024-01-29 19:00:01
【问题描述】:
如何将三态总线转换为两态逻辑以进行综合?
我做了一个小测试
module test1( inout tristate, output flattened);
assign flattened = tristate ? 1 : 0;
endmodule
module test2( inout tristate, output reg flattened);
always @(tristate) begin
case(tristate)
0: flattened = 0;
default: flattened = 1;
endcase
end
endmodule
`timescale 1ns / 1ps
module test_tb;
reg tristateEnable;
reg tristateValue;
wire tristate = tristateEnable ? tristateValue : 1'bz;
wire flattened1, flattened2;
test1 uut1(tristate, flattened1);
test2 uut2(tristate, flattened2);
initial begin
tristateValue = 1'b0;
tristateEnable = 1;
#10 tristateValue = 1'b1;
#10 tristateEnable = 1'b0;
end
endmodule
模拟它我得到了模块test1将flattened设置为X,模块test2将它设置为1,后者是我想要的,但我还没有合成它。有没有更好/标准的方法来做到这一点?
【问题讨论】:
-
我使用 VCS 模拟了您的测试,结果模拟结果对于 test1 和 test2 是相同的。你能详细说明你的意图吗?我认为 test1 可能更可取,只是一个猜测。
标签: verilog synthesis tri-state-logic