【发布时间】:2018-03-27 09:59:43
【问题描述】:
我正在尝试实现一个测试平台并编写所有 我的 DUT 到文件的可能输入组合:
module CONTROL_LOGIC_tb();
// Inputs
reg [3:0] select_i;
reg [15:0] addr_i;
// Output
wire [7:0] ctrl_o;
// Instantiate the UUT
CONTROL_LOGIC UUT(
.select_i(select_i),
.ctrl_i(addr_i),
.ctrl_o(ctrl_o) );
// Do test
integer outFile;
integer idx;
initial begin
select_i = 0;
outFile = $fopen(".\\CTRL.bin", "wb");
for (idx = 0; idx < 65536; idx = idx +1)
begin
addr_i = idx;
$fwrite(outFile, "%c", ctrl_o);
end
$fclose(outFile);
$finish;
end
endmodule
不幸的是,文件“CTRL.bin”没有填充任何有用的数据。 但是它的大小是 64kB……至少这是可行的!
使用变量“idx”作为 DUT 的输入我做错了什么?
ps:我在 ispLever 中使用 Aldec 函数模拟(如果这很重要?)。
【问题讨论】:
标签: verilog test-bench