>我有一个连续的十六进制文件,例如 0000 ffff 0000 ffff acac 0000 ffff 000我需要将读取的值分配给tb_b = data[15:8]tb_a = 数据[7:0]
法典:
initial
begin
while(cond) begin
$readmemh("test.txt",f_data,0, 2**32);
tb_b = data[15:8];
tb_a = data[7:0];
...
end
有人可以告诉我如何做到这一点。
非常感谢
改用$fscanf
。
int file, status;
initial
begin
file = $fopen("test.txt","r");
if (file == 0) $error("text.txt not opened");
while(cond) begin
status = $fscanf(file,"%h",data);
tb_b = data[15:8];
tb_a = data[7:0];
...
end