1k~100M频率计的设计与仿真
源码
`timescale 1ns / 1ps
module fre_1(
input clk_low,
input clk_test,
input clk_high,
input rst1_n,
input rst2_n,
input rst3_n,
output [31:0]out
);
reg [31:0]cout1;
reg [31:0]cout2;
reg [31:0]C1;
reg [31:0]C2;
reg flag;
reg [31:0]out;
wire [31:0]out_buff;
assign out_buff=(C1>C2)?(C12000):(50000000/C2);
always @(posedge clk_test or posedge rst1_n)
begin
if(rst1_n1)
begin cout1<=0;C1<=1;end
else if(clk_low0)
begin
if(cout1<=C1)
begin cout1<=0; end
else C1<=cout1;
end
else
begin
if(cout1!=0)
begin cout1<=0;end
C1<=C1;
cout1<=cout1+1;
end
end
a