V
Verictor
Guest
Hi,
I am looking the following state machine. It seems no problem on
simulation. But when synthesize it, the problem turns out that one of
the input nets (input b) can't connect to any net (no warning on input
a though).
So how to assign inputs (a,b, and c in the example) to drive output
(z) and internal registers (z1 and z2)? The internal registers are
needed.
module fsm(clock, reset, a, b, c, z);
input clock, reset;
input a, b, c;
output z;
reg z;
reg z1, z2;
parameter s0 = 1'b0,
s1 = 1'b1;
reg state, next;
always @(posedge clock or negedge reset) begin
if (!reset) begin
state <= s0;
end else begin
state <= next;
end
end
always @(*) begin
next = 1'bx;
z = 1'b0;
z1 = 1'b0;
z2 = 1'b0;
case(state)
s0: if (a&b) begin
next = s1;
z1 = c;
z2 = a;
end
s1: if(c) begin
next = s0;
z = a;
z1 = 1'b1;
z2 = b;
end
endcase
end
endmodule
I am looking the following state machine. It seems no problem on
simulation. But when synthesize it, the problem turns out that one of
the input nets (input b) can't connect to any net (no warning on input
a though).
So how to assign inputs (a,b, and c in the example) to drive output
(z) and internal registers (z1 and z2)? The internal registers are
needed.
module fsm(clock, reset, a, b, c, z);
input clock, reset;
input a, b, c;
output z;
reg z;
reg z1, z2;
parameter s0 = 1'b0,
s1 = 1'b1;
reg state, next;
always @(posedge clock or negedge reset) begin
if (!reset) begin
state <= s0;
end else begin
state <= next;
end
end
always @(*) begin
next = 1'bx;
z = 1'b0;
z1 = 1'b0;
z2 = 1'b0;
case(state)
s0: if (a&b) begin
next = s1;
z1 = c;
z2 = a;
end
s1: if(c) begin
next = s0;
z = a;
z1 = 1'b1;
z2 = b;
end
endcase
end
endmodule