我正在尝试实现一个测试台并将我的 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 功能模拟(如果这很重要?)。