我試圖運行該代碼,它是給這些錯誤: 語法錯誤附近的「總是」 語法錯誤附近「endmodule」語法錯誤Verilog代碼
我不明白什麼這是錯誤的碼。這裏是代碼:
module fortran_v2(
input clk
);
parameter N=8;
parameter M=6;
parameter size=1000;
reg [N-1:0] A [0:size-1];
reg [N-1:0] B [0:size-1];
reg [M-1:0] C [0:size-1];
reg [M-1:0] D [0:size-1];
reg [15:0] k=0;
integer open_file;
initial begin
open_file= $fopen("output.txt","w");
end
always @ (posedge clk) begin
if(k<1000)
k<=k+1;
else
k<=1000;
end
always @ (posedge clk) begin
if(k<1000) begin
A[k]<=$random;
B[k]<=$random;
end
always @ (posedge clk) begin
if (k<1000) begin
C[k]<=A[k]*B[k] +5;
D[k]<=A[k]+B[k] -5;
$fwrite(open_file,"A[%d",k,"]",A[k],"B[%d",k,"]",B[k],"C[%d",k,"]",C[k],"D[%d",k,"]",D[k]);
end
else
A[k]=0;
end
endmodule
糟糕!快點總是擔心:( – 2014-12-07 10:04:28