请教一下这个verilogHDL编的程序错误怎么改
DINT_DOUT,DINT_RDY);
input DINT_DIN;
input DINT_ND;
input [8:0] INDEX_IN;
input [1:0] MODE_CON;
input DINT_RST;
input DINT_CLK;
output DINT_DOUT;
output DINT_RDY;
reg DIN; //register of input
reg ND; //enable of output
reg [8:0] INDEX; //register of index for output
reg [1:0] MODE;
reg [9:0] WA_1; //DINT_RAM_1 write address
reg DIN_1; //DINT_RAM_1 input register
reg REN_1; //DINT_RAM_1 enable read
reg WEN_1; //DINT_RAM_1 enable write
reg WAC_1; //control write address of 1st interleaver
reg DINT_RDY_1; //DINT_RAM_1 enable output
reg DIN_2; //DINT_RAM_2 input register
reg [4:0] WA_2; //DINT_RAM_2 write address
reg WEN_2; //DINT_RAM_2 enable write
reg REN_2; //DINT_RAM_2 enable read
reg WAC_2; //control write address of 2ed interleaver
reg DINT_DV; //enable output
reg DINT_DOUT; //output register
reg DINT_RDY; //synchronize with output
wire [9:0] RA_1; //DINT_RAM_1 read address
wire [9:0] Q_1; //RCOUNT_1 counter of output
wire DOUT_1; //DINT_RAM_1 output
wire RST; //reset of IP core, enable under high leavel
wire [4:0] Q_2; //RCOUNT_2 counter of output
wire [4:0] RA_2; //DINT_RAM_2 read address
wire DOUT_2; //DINT_RAM_2 output
assign RST=~DINT_RST;
assign RA_1=Q_1;
………………省去部分
always @ (negedge DINT_RST or posedge DINT_CLK)
if (!DINT_RST)
begin
WAC_1<=1'b0;
WA_1<=10'b0000000000;
WEN_1<=1'b0;
DIN_1<=1'b0;
REN_1<=1'b0;
DINT_RDY_1<=1'b0;
end
else
begin
case (MODE)
2'b10:
begin
if (ND)
begin
if (!WAC_1) // input data write in the BRAM first half part and the end alternatively, under control of WAC_1.
WA_1<=(INDEX[3:0]<<3)+(INDEX[3:0]<<2)+INDEX[8:4];
else
WA_1<=(INDEX[3:0]<<3)+(INDEX[3:0]<<2)+INDEX[8:4]+192;
WEN_1<=1'b1;
DIN_1<=DIN;
if(INDEX==191)
begin
WAC_1<=~WAC_1;
REN_1<=1'b1;
end
end
else
begin
WA_1<=10'b0000000000;
WEN_1<=1'b0;
DIN_1<=1'b0;
end
if (Q_1==191 || Q_1==383) //finish read of BRAM
REN_1<=1'b0;
end
endcase
if (REN_1)
DINT_RDY_1<=1'b1;
else
DINT_RDY_1<=1'b0;
end
提示错误出在我用红色标记的那一句,错误如下:
Error (10170): Verilog HDL syntax error at data_interleaver.v(129) near text
Error (10170): Verilog HDL syntax error at data_interleaver.v(129) near text "?; expecting ";", or "@", or an identifier, or a system task, or "{", or a sequential statement
Error (10170): Verilog HDL syntax error at data_interleaver.v(129) near text
提示就那一句的问题,text后边是一个口,但是复制不下来。
等你们的答案啊
129行是那一行啊。
PS:一个aways里面只给一个变量赋值,这样也好看点
检查一下begin---end,是否配对了
有点乱,建议先整理一下缩进,这样别人帮你debug会轻松点
上面两个朋友说的对。不管写代码还是写程序,都要注意代码的风格,切不可想怎么写就怎么写。
else
WA_1<=(INDEX[3:0]<<3)+(INDEX[3:0]<<2)+INDEX[8:4]+192;
WEN_1<=1'b1;
DIN_1<=DIN;
if(INDEX==191)
begin
WAC_1<=~WAC_1;
REN_1<=1'b1;
end
end
这里有个begin,两个end
if(INDEX==191) // 这一行有一个特殊的空白符号,不是空格也不是Tab
我用Hex打开看了,20是空格,09是Tab,0D0A是"\r\n",但是在那堆空白中居然有“AD B8”,
显然不是ASCII字符。
谢谢各位的帮助,特别是7楼的qingweisan,你的意见对我非常又帮助,楼上说的格式问题的确需要改进,O(∩_∩)O谢谢了,至于begin和end 配对这里应该是没问题的。
可是不行啊,上边说字符格式有问题,我从新输入也不行,还是同意的错误
继续求解……求高人指点,这个问题已经困扰我多时了……
这。很难检查啊
你这代码写的也太业余了吧!好好看看别人的代码再自己写,先磨刀
是不是你后面的数字要给换成9'd191呀?写成if(INDEX==9'd191)
你线unix2dos,然后看看有没有半角全角问题
就是那个口的问题。
非法字符。
查找下begin...end是否匹配
谢谢alexander21th,就是您说的原因,我现在改正错误了,太谢谢了,多多指教