- Intital revision

git-svn-id: http://moon:8086/svn/vhdl/trunk@166 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
2008-12-29 14:05:12 +00:00
parent f7e19d3d44
commit d9ba866ed0
20 changed files with 2050 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
vlib work
vcom -explicit -93 "../../../fixed/fixed_pkg_c.vhd"
vcom -explicit -93 "../../../fixed/fixed_util_pkg.vhd"
vcom -explicit -93 "../../../PCK_FIO-2002.7/PCK_FIO_1993.vhd"
vcom -explicit -93 "../../../PCK_FIO-2002.7/PCK_FIO_1993_BODY.vhd"
vcom -explicit -93 "../../cordic/src/cordic_pkg.vhd"
vcom -explicit -93 "../../cordic/src/cordic_pipe_stage.vhd"
vcom -explicit -93 "../../cordic/src/cordic_pipe_pre.vhd"
vcom -explicit -93 "../../cordic/src/cordic_pipe_post.vhd"
vcom -explicit -93 "../../cordic/src/cordic_pipe_top.vhd"
vcom -explicit -93 "../../nco/src/mix_cordic.vhd"
vcom -explicit -93 "../../decimator/CIC/src/cic_i_pipe.vhd"
vcom -explicit -93 "../../decimator/CIC/src/cic_c_pipe.vhd"
vcom -explicit -93 "../../decimator/CIC/src/cic_decim_pipe.vhd"
vcom -explicit -93 "../src/ddc.vhd"
vcom -explicit -93 "../src/tb_ddc.vhd"
vsim -t 1ps -lib work tb_ddc
do {tb_ddc.wdo}
view wave
view structure
view signals
run 400us
+64
View File
@@ -0,0 +1,64 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate -format Logic /tb_ddc/clk
add wave -noupdate -format Logic /tb_ddc/rst
add wave -noupdate -format Logic /tb_ddc/ddc_shift_we
add wave -noupdate -format Literal /tb_ddc/ddc_shift_addr
add wave -noupdate -format Literal /tb_ddc/ddc_shift_in
add wave -noupdate -format Logic /tb_ddc/ddc_nco_rst
add wave -noupdate -format Logic /tb_ddc/ddc_nco_en
add wave -noupdate -format Literal -radix decimal /tb_ddc/ddc_freq_in
add wave -noupdate -format Literal -radix decimal /tb_ddc/ddc_phase_in
add wave -noupdate -format Literal /tb_ddc/ddc_ratio
add wave -noupdate -format Literal /tb_ddc/ddc_diff_delay
add wave -noupdate -format Literal -radix decimal /tb_ddc/ddc_din_i
add wave -noupdate -format Literal -radix decimal /tb_ddc/ddc_din_q
add wave -noupdate -format Literal -radix decimal /tb_ddc/ddc_dout_i
add wave -noupdate -format Literal -radix decimal /tb_ddc/ddc_dout_q
add wave -noupdate -format Logic /tb_ddc/ddc_dout_vld
add wave -noupdate -format Logic /tb_ddc/ddc_din_vld
add wave -noupdate -format Logic /tb_ddc/rfgen_nco_rst
add wave -noupdate -format Logic /tb_ddc/rfgen_nco_en
add wave -noupdate -format Literal -radix decimal /tb_ddc/rfgen_freq_in
add wave -noupdate -format Literal -radix decimal /tb_ddc/rfgen_phase_in
add wave -noupdate -format Literal -radix decimal /tb_ddc/rfgen_din_i
add wave -noupdate -format Literal -radix decimal /tb_ddc/rfgen_din_q
add wave -noupdate -format Literal -radix decimal /tb_ddc/rfgen_dout_i
add wave -noupdate -format Literal -radix decimal /tb_ddc/rfgen_dout_q
add wave -noupdate -format Logic /tb_ddc/rfgen_dout_vld
add wave -noupdate -format Logic /tb_ddc/fileout_enable
add wave -noupdate -divider DDC
add wave -noupdate -format Literal -radix decimal /tb_ddc/uut/din_i
add wave -noupdate -format Literal -radix decimal /tb_ddc/uut/din_q
add wave -noupdate -format Literal -radix decimal /tb_ddc/uut/dout_i
add wave -noupdate -format Literal -radix decimal /tb_ddc/uut/dout_q
add wave -noupdate -format Logic /tb_ddc/uut/din_vld
add wave -noupdate -format Logic /tb_ddc/uut/dout_vld
add wave -noupdate -format Literal -radix decimal /tb_ddc/uut/mix_dout_i
add wave -noupdate -format Literal -radix decimal /tb_ddc/uut/mix_dout_q
add wave -noupdate -format Logic /tb_ddc/uut/mix_dout_vld
add wave -noupdate -format Literal -radix decimal /tb_ddc/uut/dec_dout_i
add wave -noupdate -format Literal -radix decimal /tb_ddc/uut/dec_dout_q
add wave -noupdate -format Logic /tb_ddc/uut/dec_dout_vld_i
add wave -noupdate -format Logic /tb_ddc/uut/dec_dout_vld_q
add wave -noupdate -format Logic /tb_ddc/ddc_din_vld
add wave -noupdate -format Analog-Step -height 50 -scale 10.0 /tb_ddc/ddc_i_out_f
add wave -noupdate -format Analog-Step -height 50 -scale 10.0 /tb_ddc/ddc_q_out_f
add wave -noupdate -format Analog-Step -height 50 -scale 10.0 /tb_ddc/rfgen_i_out_f
add wave -noupdate -format Analog-Step -height 50 -scale 10.0 /tb_ddc/rfgen_q_out_f
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {399851293 ps} 0}
configure wave -namecolwidth 150
configure wave -valuecolwidth 100
configure wave -justifyvalue left
configure wave -signalnamewidth 1
configure wave -snapdistance 10
configure wave -datasetprefix 0
configure wave -rowmargin 4
configure wave -childrowmargin 2
configure wave -gridoffset 0
configure wave -gridperiod 100
configure wave -griddelta 40
configure wave -timeline 1
update
WaveRestoreZoom {399827014 ps} {400009105 ps}
+36
View File
@@ -0,0 +1,36 @@
% Read data
function tb_results()
fa = 100.0;
f = TEXTREAD('freq.txt')*1E-6
R = 64;
fa_dec = fa/R
N_pfir = 63;
I_out_dec = TEXTREAD('i_dec.txt')';
Q_out_dec = TEXTREAD('q_dec.txt')';
N_dec = length(I_out_dec)-2*N_pfir;
N_fft_dec = N_dec
N_fft2_dec = N_fft_dec/2;
fft_y2_dec = 2/N_fft_dec*abs(fft(I_out_dec(2*N_pfir+1:N_fft_dec+2*N_pfir).*hann(N_fft_dec)'));
pfir_b = sinc(0.2*(-(N_pfir-1)/2:1:(N_pfir)/2));
pfir_b = pfir_b/sum(pfir_b).*blackman(N_pfir)';
I_out_dec_pfir = filter(pfir_b, 1, I_out_dec);
Q_out_dec_pfir = filter(pfir_b, 1, Q_out_dec);
fft_y2_dec_pfir = 2/N_fft_dec*abs(fft(I_out_dec_pfir(2*N_pfir+1:N_fft_dec+2*N_pfir).*hann(N_fft_dec)'));
% Output
close all;
plot(fa/(R*N_fft_dec)*(0:N_fft2_dec),20*log10(fft_y2_dec(1:N_fft2_dec+1)), '-', fa/(R*N_fft_dec)*(0:N_fft2_dec),20*log10(fft_y2_dec_pfir(1:N_fft2_dec+1)), '-'); grid;
xlabel('MHz');
figure;
plot(1:length(I_out_dec_pfir), I_out_dec_pfir, 1:length(Q_out_dec_pfir), Q_out_dec_pfir); grid;
figure;
freqz(pfir_b, 1, 1000);
figure;
plot(pfir_b); grid;