急啊!众位,这个程序我在Quartus II9.0上分析,老是出现错误,耽误各位一点时间,谢谢 20
moduleuart(IN,CLK_10MHz,Q,reset);inputCLK_10MHz,IN,reset;//输入信号:时钟信号CLK_10MHz,输入的串行信号...
module uart(IN,CLK_10MHz,Q, reset);
input CLK_10MHz, IN, reset; //输入信号:时钟信号CLK_10MHz,输入的串行信号IN,复位信号reset
output [7:0] Q; //输出的并行信号
reg[7:0] P; //寄存器P,存放接收到的串行数据值
reg[3:0] i; //计数器i,用来记录接收到的数据位的数目
reg a; //寄存器a,用来判断是否开始接收数据
reg k; //寄存器k,用来判断模块是否完成数据接收
CNT cnt(CLK_10MHz, CLK_9600Hz, reset); //分频器进行分频
always@(posedge CLK_9600Hz or posedge reset)
begin
if(reset) //如果复位信号到来,则进行模块初始化
begin
i<=0;
k<=1;
a<=1;
end
if(IN==0&&a=1) //如果数据起始位到来,则准备接收数据
a<=0;
if(a==0) //如果接收控制寄存器a表明可以接收数据,则开始接收数据
begin
if(i<8&&k==1) //如果接收到的数据位小于8位,则继续进行接收
begin
P[i] <=IN;
i<=i+1; //接收一位数据,则计数器加1
end
else//如果接收到的数据位大于8位,则停止接收数据
k<=0;
end
end
assign Q=P;
endmodule
Error (10200): Verilog HDL Conditional Statement error at uart.v(17): cannot match operand(s) in the condition to the corresponding edges in the enclosing event control of the always construct
Error (10200): Verilog HDL Conditional Statement error at uart.v(21): cannot match operand(s) in the condition to the corresponding edges in the enclosing event control of the always construct
Error: Can't elaborate top-level user hierarchy 展开
input CLK_10MHz, IN, reset; //输入信号:时钟信号CLK_10MHz,输入的串行信号IN,复位信号reset
output [7:0] Q; //输出的并行信号
reg[7:0] P; //寄存器P,存放接收到的串行数据值
reg[3:0] i; //计数器i,用来记录接收到的数据位的数目
reg a; //寄存器a,用来判断是否开始接收数据
reg k; //寄存器k,用来判断模块是否完成数据接收
CNT cnt(CLK_10MHz, CLK_9600Hz, reset); //分频器进行分频
always@(posedge CLK_9600Hz or posedge reset)
begin
if(reset) //如果复位信号到来,则进行模块初始化
begin
i<=0;
k<=1;
a<=1;
end
if(IN==0&&a=1) //如果数据起始位到来,则准备接收数据
a<=0;
if(a==0) //如果接收控制寄存器a表明可以接收数据,则开始接收数据
begin
if(i<8&&k==1) //如果接收到的数据位小于8位,则继续进行接收
begin
P[i] <=IN;
i<=i+1; //接收一位数据,则计数器加1
end
else//如果接收到的数据位大于8位,则停止接收数据
k<=0;
end
end
assign Q=P;
endmodule
Error (10200): Verilog HDL Conditional Statement error at uart.v(17): cannot match operand(s) in the condition to the corresponding edges in the enclosing event control of the always construct
Error (10200): Verilog HDL Conditional Statement error at uart.v(21): cannot match operand(s) in the condition to the corresponding edges in the enclosing event control of the always construct
Error: Can't elaborate top-level user hierarchy 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询