我尝试使用行为建模在具有适当测试台的 Verilog 中实现 10:1024 位解码器。代码如下所示。
module decoder(input [9:0]address,output reg [1023:0]add);
reg [9:0]i;
always@(address) begin
for(i=0;i<1024;i=i+1) begin
add[i]=(address==i)?1'b1:1'b0;
end
end
endmodule
module tg(output reg [9:0]address,input [1023:0]add);
initial begin
$monitor($time,,,,"address=%b add=%b",address,add);
address=1023;
#2 address=0;
#2 address=1;
#2 $finish;
end
endmodule
module wb;
wire [9:0]a;
wire [1023:0]b;
decoder d1(a,b);
tg tg_1(a,b);
endmodule
但是在编译后运行代码时没有看到 o/p...帮我修复此代码以实现 10:1024 位解码器...