To have review for spyglass cdc, first we need code, here i attached 2 codes 1] cdc_test2.v is top 2] clk_rst_unit1.v is for clk and clk div and reset logic. For test there is tb.v as well
module clk_rst_unit1
( clkin,rstin,clk_div2_o,clk_div4_o,clk_div8_o,rst_o);
input clkin,rstin;
output reg clk_div2_o,clk_div4_o,clk_div8_o,rst_o;
reg q0,q1;
always @(posedge clkin,negedge rstin)
if (~rstin)
clk_div2_o <= 1'b0;
else
clk_div2_o <= ~clk_div2_o;
always @(posedge clk_div2_o,negedge rst_o)
if (~rst_o) begin
clk_div4_o <= 1'b0;
end
else
begin
clk_div4_o <= ~ clk_div4_o;
end
always @(posedge clk_div4_o,negedge rst_o)
if (~rst_o) begin
clk_div8_o <= 1'b0;
end
else
begin
clk_div8_o <= ~ clk_div8_o;
end
always @ (posedge clkin or negedge rstin)
if (!rstin) begin
q0 <= 0;
q1 <= 0;
rst_o <= 0;
end
else begin
q0 <= 1'b1;
q1 <= q0;
rst_o <= q1;
end
endmodule
module clk_rst_unit1
( clkin,rstin,clk_div2_o,clk_div4_o,clk_div8_o,rst_o);
input clkin,rstin;
output reg clk_div2_o,clk_div4_o,clk_div8_o,rst_o;
reg q0,q1;
always @(posedge clkin,negedge rstin)
if (~rstin)
clk_div2_o <= 1'b0;
else
clk_div2_o <= ~clk_div2_o;
always @(posedge clk_div2_o,negedge rst_o)
if (~rst_o) begin
clk_div4_o <= 1'b0;
end
else
begin
clk_div4_o <= ~ clk_div4_o;
end
always @(posedge clk_div4_o,negedge rst_o)
if (~rst_o) begin
clk_div8_o <= 1'b0;
end
else
begin
clk_div8_o <= ~ clk_div8_o;
end
always @ (posedge clkin or negedge rstin)
if (!rstin) begin
q0 <= 0;
q1 <= 0;
rst_o <= 0;
end
else begin
q0 <= 1'b1;
q1 <= q0;
rst_o <= q1;
end
endmodule
`timescale 1ns / 1ps
module tb();
reg clkin, rstin;
reg [7:0] din1,din2;
wire clk2o,clk4o,clk8o,rsto;
wire [7:0] do1,do2;
cdc_test2 inst (
.din1(din1),
.do1(do1),
.din2(din2),
.do2(do2),
.clkin(clkin),
.rstin(rstin),
.clk2o(clk2o),
.clk4o(clk4o),
.clk8o(clk8o),
.rsto(rsto));
initial
begin
clkin = 1'b0;
forever
#50 clkin = ~clkin;
end
initial
begin
rstin = 1'b0;
#100;
rstin = 1'b1;
#5000;
end
initial
repeat (10)
begin
#200;
din1 = $random;
end
initial
repeat (10)
begin
#400;
din2 = $random;
end
endmodule
The block / schematic diagram is as below , fast to slow , slow to fast
pair are there, din1 - do1 is fast to slow , din2 - do2 is slow to fast data paths
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
Your article helped me a lot, is there any more related content? Thanks!
Your article helped me a lot, is there any more related content? Thanks!
Superb and well-thought-out content! If you need some information about Cosmetic Treatment, then have a look at QU6