Verilog 为什么';这难道不是真的吗?
对于Verilog中的以下代码段:Verilog 为什么';这难道不是真的吗?,verilog,Verilog,对于Verilog中的以下代码段: //////////////////////////// reg[0:7] fat[0:511]= {'hF8, 'hFF, 'hFF , 'hFF , 'hFF , 'hFF , 'hFF , 'hFF , hFF , 'hFF , 'h06 , 'h00 , 'h07 , 'h00 , 'h08 ... ); // resembles fat 1 region on a sd card, read using hex editor. reg[0:32
////////////////////////////
reg[0:7] fat[0:511]= {'hF8, 'hFF, 'hFF , 'hFF , 'hFF , 'hFF , 'hFF , 'hFF , hFF , 'hFF , 'h06 , 'h00 , 'h07 , 'h00 , 'h08 ... ); // resembles fat 1 region on a sd card, read using hex editor.
reg[0:32] fat_counter2 ;
reg[0:31] music_stop_add[0:1];
reg music_counter = 0;
task stop_address;
begin
if((fat[fat_counter2] == 'hFF )&& (fat[fat_counter2+1] == 'hFF) && (b==0))begin
music_stop_add[music_counter] <= ((((fat_counter2/2)-2)*64)+509)*512; //
b <= 1;
end else begin
fat_counter2 <= fat_counter2 + 1;
end
always @ (posedge clk_100mhz) begin
repeat(256)begin
stop_address;
end
end
////////////////////////////////
////////////////////////////
reg[0:7]fat[0:511]={'hF8',hFF',hFF',hFF',hFF',hFF',hFF',hFF',hFF',h06',h00',h07',h00',h08…//类似sd卡上的fat 1区域,使用十六进制编辑器读取。
reg[0:32]fat_counter 2;
注册[0:31]音乐停止添加[0:1];
reg music_计数器=0;
任务停止地址;
开始
如果((fat[fat\U计数器2]='hFF)&(fat[fat\U计数器2+1]='hFF)&(b==0))开始
music\u stop\u add[music\u counter]Areg
默认初始化为x。fat\u counter 2
为x,导致if
子句计算为false。通过将此$display
添加到任务中,向自己证明这一点:
task stop_address;
begin
$display("fat_counter2=%x fat[fat_counter2]=%x", fat_counter2, fat[fat_counter2]);
if((fat[fat_counter2] == 'hFF )&& (fat[fat_counter2+1] == 'hFF) && (b==0))begin
您需要以某种方式初始化fat_计数器2