J
jacky
Guest
I have designed a syhnchronous divide by 3 sequential circuit with 2 D
flip flops
I have written this verilog code :
module sync_counter(
output reg q2;
input clk,rst_n);
reg d1,q,d2;
always @(q1) begin
d1 = q2;
d2 = ~(q1 | q2);
end
always @(posedge clk or negedge rst_n)
begin
if (rst_n)
q2 <= 0;
q1 <= 0;
end
else begin
q2<=d2;
q1 <= d1;
end
endmodule
I guess combinational block i have implemented is wrong. Can anyone
help
--Jacky
flip flops
I have written this verilog code :
module sync_counter(
output reg q2;
input clk,rst_n);
reg d1,q,d2;
always @(q1) begin
d1 = q2;
d2 = ~(q1 | q2);
end
always @(posedge clk or negedge rst_n)
begin
if (rst_n)
q2 <= 0;
q1 <= 0;
end
else begin
q2<=d2;
q1 <= d1;
end
endmodule
I guess combinational block i have implemented is wrong. Can anyone
help
--Jacky