Improved NCO: 200MHz
This commit is contained in:
@@ -10,8 +10,6 @@ module top_generic(
|
||||
output wire[5:0] r2r
|
||||
);
|
||||
|
||||
`include "core/nco_q15_funcs.vh"
|
||||
|
||||
assign led_green = 1'b0;
|
||||
assign led_red = 1'b0;
|
||||
|
||||
@@ -19,6 +17,7 @@ module top_generic(
|
||||
reg [11:0] count;
|
||||
localparam integer DIV_MAX = 100_000 - 1; // 1 ms tick at 100 MHz
|
||||
reg [16:0] div_counter = 0; // enough bits for 100k (2^17=131072)
|
||||
reg [31:0] freq;
|
||||
always @(posedge aclk) begin
|
||||
if (!aresetn) begin
|
||||
div_counter <= 0;
|
||||
@@ -34,6 +33,7 @@ module top_generic(
|
||||
div_counter <= div_counter + 1'b1;
|
||||
end
|
||||
end
|
||||
freq <= count;
|
||||
end
|
||||
|
||||
|
||||
@@ -41,12 +41,11 @@ module top_generic(
|
||||
wire clk_en;
|
||||
nco_q15 #(
|
||||
.CLK_HZ(100_000_000),
|
||||
.PHASE_BITS(16),
|
||||
.FS_HZ(40_000)
|
||||
) nco (
|
||||
.clk (aclk),
|
||||
.rst_n (aresetn),
|
||||
.ftw_in (ftw_from_hz(count, 16, 40_000)),
|
||||
.freq_hz(freq),
|
||||
.sin_q15(sin_q15),
|
||||
.cos_q15(),
|
||||
.clk_en (clk_en)
|
||||
|
||||
Reference in New Issue
Block a user