Forum Discussion
NCO and FIR COmpiler Megafunction performance
For learning purpose,
I just added two NCO O/Ps with 1 MHz and 5 MHz. NCO1 = 1 MHz NCO2 = 5 MHz and using FIR Compiler unit ( with Fc = 1.25 MHz), I filtered the mixture of these two sine waves. The filtered O/P is a sine wave, but not near 1 MHz, its around 500 KHz. pls see the image attached. Any suggestions for improvement. thanks19 Replies
- Altera_Forum
Honored Contributor
Are you sure about your figures? NCO1 is meant to be 1MHz yet you have several cycles over 1000ns interval as per your diagram(you should have one cycle running for 1000ns period). it is probably 10MHz.
- Altera_Forum
Honored Contributor
Thanks Kaz.
It is not 1000 ns, it is 10000 ns, and it covers 10 cycles. so 1 cycle = 1000 ns = 1 MHz. - Altera_Forum
Honored Contributor
My eyesight is gone??
OK in that case if you save your NCO1,NCO2, adder, filtered output to work space as array and attach it to your post then I might get better eyesight - Altera_Forum
Honored Contributor
Sure,
I am attaching .VWF as well as .VCD file. Also, if you want to see the project , I can upload it. - Altera_Forum
Honored Contributor
I don't have your tools exactly. I only wanted mat files (or txt files) for the outputs of NCO1,NCO2,adder,filter. just 1000 samples per each will do
- Altera_Forum
Honored Contributor
I don't understand your way of operating the filter flow control signals. You're picking a few samples of the input data instead of reading it continuously.
- Altera_Forum
Honored Contributor
This is the top level code :
The mixing of two signals is being performed here in the top level. module ncofilter(phi_inc_i,phi_inc_i_2 ,
clk,
reset_n,
clken,
fsin_o,
fcos_o,
fsin_o_2,
out_valid,
out_valid_2,
connect_o,
ast_sink_valid,
ast_source_ready,
ast_sink_error,
ast_sink_ready,
ast_source_valid,
ast_source_error,
ast_source_data);
input [31:0] phi_inc_i;
input [31:0] phi_inc_i_2;
input clk;
input reset_n;
input clken;
output [17:0] fsin_o;
output [17:0] fcos_o;
output [17:0] fsin_o_2;
output out_valid;
output out_valid_2;
output [18:0] connect_o;
//reg [18:0] connect;
reg [18:0] connect_o;
input ast_sink_valid;
input ast_source_ready;
input [1:0] ast_sink_error;
output [31:0] ast_source_data;
output ast_sink_ready;
output ast_source_valid;
output [1:0] ast_source_error;
reg [18:0] mix;
//assign connect_o = mix;
my_nco_4 nco_3(
.phi_inc_i(phi_inc_i),
.clk(clk),
.reset_n(reset_n),
.clken(clken),
.fsin_o(fsin_o),
.fcos_o(fcos_o),
.out_valid(out_valid));
new_nco nco_4(
.phi_inc_i(phi_inc_i_2),
.clk(clk),
.reset_n(reset_n),
.clken(clken),
.fsin_o(fsin_o_2),
.out_valid(out_valid_2));
my_filter filter_1(
.clk(clk),
.reset_n(reset_n),
.ast_sink_data(mix),
.ast_sink_valid(ast_sink_valid),
.ast_source_ready(ast_source_ready),
.ast_sink_error(ast_sink_error),
.ast_source_data(ast_source_data),
.ast_sink_ready(ast_sink_ready),
.ast_source_valid(ast_source_valid),
.ast_source_error(ast_source_error));
always @(posedge clk)
begin
mix <= fsin_o +fsin_o_2;
end
always @(posedge clk)
begin
connect_o <= mix;
end
endmodule Hope it helps.
- Altera_Forum
Honored Contributor
@ kaz
in that case, you can use gtkwave+ (open source) to view vcd file. i dont know how to convert the file format into txt etc. - Altera_Forum
Honored Contributor
Another problem:
Is summing both 18 bit signals to 18 bit (causing overflow) and than assigning the result to a 19 bit variable.mix <= fsin_o +fsin_o_2; - Altera_Forum
Honored Contributor
I reviewed the vfw waveform and think to understand the filter problem. It's operating at 5 MHz sampling rate only, although ast_sink_valid is pemanently enabled with 100 MHz input clock. It's the filter design.