代码拉取完成,页面将自动刷新
/*
http://surabhig.com/2-bit-signal-generator-nco-in-verilog/
This module generates sin and cos signals according to the input phase_inc_carr
To compute phase_inc use this equation:
f(desired freq) = phase_inc * 2^N * f(clk freq);
Where sin_out and cos_out will operate at desired frequency.
N is the bit width of phase_inc (64 in this case)
If phase_inc limited to 64 bits... Change bits in equation correspondingly.
*/
module nco_sig
(clk,
phase_inc_carr,
phase_accum,
sin_out,
cos_out
);
input clk;
input [63:0] phase_inc_carr;
output sin_out;
output cos_out;
parameter IDLE_nco = 0, START_nco = 1;
reg state_nco_carr = IDLE_nco ;
output reg [63:0] phase_accum;
assign sin_out = (phase_accum[63] == 1'b1)? 1'b0 : 1'b1 ;
assign cos_out = ((phase_accum[63] ^ phase_accum[62]) == 1'b1)? 1'b0 : 1'b1;
always@(posedge clk) begin
phase_accum <= phase_accum + phase_inc_carr;
end
endmodule
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。