【发布时间】:2013-08-17 08:46:24
【问题描述】:
我希望在 verilog HDL 中实现 32 位并行并行输出。这是我写的代码...
module pipo(input_seq, answer,reset, clock);
input [31:0] input_seq;
input reset,clock;
output [31:0] answer;
always @ (reset)
begin
if(!reset)
begin
answer[31:0]<=1'b0;
end
end
always @ (posedge clock)
begin
answer[31:1]<=input_seq[30:0];
end
endmodule
但是这会导致以下错误日志(使用iverilog):
pipo.v:10: error: answer['sd31:'sd0] is not a valid l-value in pipo.
pipo.v:4: : answer['sd31:'sd0] is declared here as wire.
pipo.v:16: error: answer['sd31:'sd1] is not a valid l-value in pipo.
pipo.v:4: : answer['sd31:'sd1] is declared here as wire.
Elaboration failed
有什么问题?
【问题讨论】:
-
您不应将寄存器的复位逻辑和寄存器的时钟逻辑拆分为单独的块。你应该有一个块
always @(posedge clock or negedge reset)。在您的设计中,如果在置位复位时时钟切换,时钟模块仍将被执行,这不是模拟触发器的正确方法。