I am looking to implement a 32-bit Parallel in-Parallel out in verilog HDL. Here is the code I have written...
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
However this leads to the following error log( using 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
What are the problems?
always @(posedge clock or negedge reset)
. In your design the clocking block will still be executed if the clock toggles while reset is asserted, which is not the correct way to model a flip flop. – Tim