- added
git-svn-id: http://moon:8086/svn/vhdl/trunk@1421 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
# -------------------------------------------------
|
||||
# Global options
|
||||
# -------------------------------------------------
|
||||
LANG_STD := 93c
|
||||
IEEE_STD := standard
|
||||
WORK_PATH := work
|
||||
SOURCE_PATH := ../src
|
||||
LIB_PATH := ../../../lib
|
||||
|
||||
# -------------------------------------------------
|
||||
# Target options
|
||||
# -------------------------------------------------
|
||||
TARGET := tb_fir_parallel
|
||||
|
||||
SOURCES := ../../../lib/src/PCK_FIO-2002.7/PCK_FIO_1993.vhd \
|
||||
../../../lib/src/PCK_FIO-2002.7/PCK_FIO_1993_BODY.vhd \
|
||||
../../../lib/src/fixed_ja/fixed_ja.vhd \
|
||||
../../../lib/src/fixed_ja/fixed_ja_body.vhd \
|
||||
../src/filter_pkg.vhd \
|
||||
../src/fir_stage_pkg.vhd \
|
||||
../src/fir_stage.vhd \
|
||||
../src/fir_parallel_pkg.vhd \
|
||||
../src/fir_parallel.vhd \
|
||||
../src/tb_fir_parallel.vhd
|
||||
|
||||
# -------------------------------------------------
|
||||
GHDL_OPT := --workdir=$(WORK_PATH) --std=$(LANG_STD) --ieee=$(IEEE_STD)
|
||||
|
||||
# -------------------------------------------------
|
||||
all: elaborate
|
||||
|
||||
.PHONY: syntax
|
||||
syntax:
|
||||
ghdl -s $(GHDL_OPT) $(SOURCES)
|
||||
|
||||
import:
|
||||
ghdl -i $(GHDL_OPT) $(SOURCES)
|
||||
|
||||
analyze:
|
||||
ghdl -a $(GHDL_OPT) $(SOURCES)
|
||||
|
||||
anaborate:
|
||||
ghdl -c $(GHDL_OPT) $(SOURCES) -e $(TARGET)
|
||||
|
||||
makeunit: analyze
|
||||
ghdl -m $(GHDL_OPT) $(TARGET)
|
||||
|
||||
elaborate: analyze
|
||||
ghdl -e $(GHDL_OPT) $(TARGET)
|
||||
|
||||
run: elaborate
|
||||
ghdl -r $(GHDL_OPT) $(TARGET) --vcd=$(TARGET).vcd --assert-level=error
|
||||
|
||||
show: $(TARGET).vcd
|
||||
gtkwave $(TARGET).vcd $(TARGET).sav
|
||||
|
||||
# -------------------------------------------------
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf $(TARGET)
|
||||
cd $(WORK_PATH); rm -rf *.o *.cf
|
||||
|
||||
# -------------------------------------------------
|
||||
@@ -0,0 +1,62 @@
|
||||
# -------------------------------------------------
|
||||
# Global options
|
||||
# -------------------------------------------------
|
||||
LANG_STD := 93c
|
||||
IEEE_STD := standard
|
||||
WORK_PATH := work
|
||||
SOURCE_PATH := ../src
|
||||
LIB_PATH := ../../../lib
|
||||
|
||||
# -------------------------------------------------
|
||||
# Target options
|
||||
# -------------------------------------------------
|
||||
TARGET := tb_nco
|
||||
|
||||
SOURCES := ../../../lib/src/PCK_FIO-2002.7/PCK_FIO_1993.vhd \
|
||||
../../../lib/src/PCK_FIO-2002.7/PCK_FIO_1993_BODY.vhd \
|
||||
../../../lib/src/fixed_ja/fixed_ja.vhd \
|
||||
../../../lib/src/fixed_ja/fixed_ja_body.vhd \
|
||||
../src/nco_pkg.vhd \
|
||||
../src/wavelut.vhd \
|
||||
../src/nco.vhd \
|
||||
../src/tb_nco.vhd
|
||||
|
||||
|
||||
# -------------------------------------------------
|
||||
GHDL_OPT := --workdir=$(WORK_PATH) --std=$(LANG_STD) --ieee=$(IEEE_STD)
|
||||
|
||||
# -------------------------------------------------
|
||||
all: elaborate
|
||||
|
||||
.PHONY: syntax
|
||||
syntax:
|
||||
ghdl -s $(GHDL_OPT) $(SOURCES)
|
||||
|
||||
import:
|
||||
ghdl -i $(GHDL_OPT) $(SOURCES)
|
||||
|
||||
analyze:
|
||||
ghdl -a $(GHDL_OPT) $(SOURCES)
|
||||
|
||||
anaborate:
|
||||
ghdl -c $(GHDL_OPT) $(SOURCES) -e $(TARGET)
|
||||
|
||||
makeunit: analyze
|
||||
ghdl -m $(GHDL_OPT) $(TARGET)
|
||||
|
||||
elaborate: analyze
|
||||
ghdl -e $(GHDL_OPT) $(TARGET)
|
||||
|
||||
run: elaborate
|
||||
ghdl -r $(GHDL_OPT) $(TARGET) --vcd=$(TARGET).vcd --assert-level=error
|
||||
|
||||
show: $(TARGET).vcd
|
||||
gtkwave $(TARGET).vcd $(TARGET).sav
|
||||
|
||||
# -------------------------------------------------
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf $(TARGET)
|
||||
cd $(WORK_PATH); rm -rf *.o *.cf
|
||||
|
||||
# -------------------------------------------------
|
||||
@@ -0,0 +1,175 @@
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
-5.764961e-004
|
||||
-3.461361e-003
|
||||
-5.835533e-003
|
||||
0.000000e+000
|
||||
1.818752e-002
|
||||
3.929949e-002
|
||||
4.025936e-002
|
||||
0.000000e+000
|
||||
-7.685423e-002
|
||||
-1.467075e-001
|
||||
-1.400504e-001
|
||||
0.000000e+000
|
||||
2.748170e-001
|
||||
6.123896e-001
|
||||
8.916664e-001
|
||||
1.000000e+000
|
||||
8.916664e-001
|
||||
6.123896e-001
|
||||
2.748170e-001
|
||||
0.000000e+000
|
||||
-1.400504e-001
|
||||
-1.467075e-001
|
||||
-7.685423e-002
|
||||
0.000000e+000
|
||||
4.025936e-002
|
||||
3.929949e-002
|
||||
1.818752e-002
|
||||
0.000000e+000
|
||||
-5.835533e-003
|
||||
-3.461361e-003
|
||||
-5.764961e-004
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
0.000000e+000
|
||||
@@ -0,0 +1,33 @@
|
||||
0.70107
|
||||
9.775391e-001
|
||||
6.577148e-001
|
||||
7.666016e-002
|
||||
-5.336914e-001
|
||||
-9.340820e-001
|
||||
-9.624023e-001
|
||||
-6.079102e-001
|
||||
-1.220703e-002
|
||||
5.869141e-001
|
||||
9.545898e-001
|
||||
9.433594e-001
|
||||
5.566406e-001
|
||||
-5.078125e-002
|
||||
-6.357422e-001
|
||||
-9.716797e-001
|
||||
-9.204102e-001
|
||||
-5.063477e-001
|
||||
1.118164e-001
|
||||
6.840820e-001
|
||||
9.843750e-001
|
||||
8.945313e-001
|
||||
4.482422e-001
|
||||
-1.738281e-001
|
||||
-7.285156e-001
|
||||
-9.931641e-001
|
||||
-8.637695e-001
|
||||
-3.925781e-001
|
||||
2.353516e-001
|
||||
7.700195e-001
|
||||
9.985352e-001
|
||||
8.315430e-001
|
||||
3.339844e-001
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
function in2wav(name)
|
||||
|
||||
fid = fopen(name, 'r');
|
||||
x = fread(fid, 'int');
|
||||
fclose(fid);
|
||||
|
||||
wavwrite(x*(2^-15), 44100, 'wav_out.wav');
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -0,0 +1,61 @@
|
||||
% Read data
|
||||
function tb_result()
|
||||
fa = 100.0;
|
||||
f = 10.2;
|
||||
|
||||
I_ud = TEXTREAD('i_ud.txt')';
|
||||
I_d = TEXTREAD('i_d.txt')';
|
||||
LFSR = TEXTREAD('lfsr.txt');
|
||||
|
||||
N= length(I_ud);
|
||||
N_fft = min(16384, N);
|
||||
N_fft2 = N_fft/2;
|
||||
|
||||
fft_y2 = 2/N_fft*abs(fft(I_ud(1:N_fft).*hann(N_fft)'));
|
||||
fft_y3 = 2/N_fft*abs(fft(I_d(1:N_fft).*hann(N_fft)'));
|
||||
|
||||
[i, v] = get_maxpur(fft_y2, fa, f);
|
||||
max_spur_freq = (i*fa/N_fft);
|
||||
max_spur_value = 20*log10(v);
|
||||
|
||||
[i, v] = get_maxpur(fft_y3, fa, f);
|
||||
max_ditherd_spur_freq = (i*fa/N_fft);
|
||||
max_ditherd_spur_value = 20*log10(v);
|
||||
|
||||
% Output
|
||||
close all;
|
||||
|
||||
subplot(2,1,1)
|
||||
plot(fa/N_fft*(0:N_fft2),20*log10(1E-6+fft_y2(1:N_fft2+1)), '-', fa/N_fft*(0:N_fft2), max_spur_value*ones(1,N_fft2+1), 'r-', [max_spur_freq], [max_spur_value], 'ro'); grid;
|
||||
spur_legend = sprintf('Max. spur %.1fdB at %.1fMHz', max_spur_value, max_spur_freq);
|
||||
legend('With dithering', spur_legend);
|
||||
legend('No dithering', spur_legend);
|
||||
title('Table');
|
||||
ylabel('dB');
|
||||
xlabel('f/MHz');
|
||||
axis([0 fa/2 -120 0]);
|
||||
subplot(2,1,2)
|
||||
plot(fa/N_fft*(0:N_fft2),20*log10(1E-6+fft_y3(1:N_fft2+1)), '-', fa/N_fft*(0:N_fft2), max_ditherd_spur_value*ones(1,N_fft2+1), 'r-', [max_ditherd_spur_freq], [max_ditherd_spur_value], 'ro'); grid;
|
||||
spur_legend = sprintf('Max. spur %.1fdB at %.1fMHz', max_ditherd_spur_value, max_ditherd_spur_freq);
|
||||
legend('With dithering', spur_legend);
|
||||
title('Table');
|
||||
ylabel('dB');
|
||||
xlabel('f/MHz');
|
||||
axis([0 fa/2 -120 0]);
|
||||
|
||||
figure;
|
||||
hist(LFSR)
|
||||
|
||||
function [max_i, max_v] = get_maxpur(spec, fa, f)
|
||||
max_v = 0;
|
||||
max_i = 0;
|
||||
for ii=1:fix(length(spec)/2+1),
|
||||
fi = ii*fa/length(spec);
|
||||
dfi = fi - f;
|
||||
if abs(dfi) > 0.5
|
||||
if spec(ii) > max_v
|
||||
max_v = spec(ii);
|
||||
max_i = ii;
|
||||
end
|
||||
end;
|
||||
end;
|
||||
@@ -0,0 +1,15 @@
|
||||
## NOTE: Do not edit this file.
|
||||
## Autogenerated by ProjNav (creatfdo.tcl) on Sat Jun 02 11:22:21 Westeuropäische Sommerzeit 2007
|
||||
##
|
||||
vlib work
|
||||
vcom -explicit -93 "../../../lib/fixed/fixed_pkg_c.vhd"
|
||||
vcom -explicit -93 "../src/mix_cpx_pkg.vhd"
|
||||
vcom -explicit -93 "../src/mix_cpx.vhd"
|
||||
vcom -explicit -93 "../src/syn_mix_cpx.vhd"
|
||||
vcom -explicit -93 "../src/tb_syn_mix_cpx.vhd"
|
||||
vsim -t 1ps -lib work tb_syn_mix_cpx
|
||||
do {tb_syn_mix_cpx.wdo}
|
||||
view wave
|
||||
view structure
|
||||
view signals
|
||||
run 1000ns
|
||||
@@ -0,0 +1,14 @@
|
||||
## NOTE: Do not edit this file.
|
||||
## Auto generated by Project Navigator for Post-Translate Simulation
|
||||
##
|
||||
vlib work
|
||||
## Compile Post-Translate Model
|
||||
vcom -explicit -93 "../syn/mix_cpx/netgen/synthesis/syn_mix_cpx_synthesis.vhd"
|
||||
vcom -explicit -93 "../src/tb_syn_mix_cpx.vhd"
|
||||
vsim -t 1ps -lib work tb_syn_mix_cpx
|
||||
do {tb_syn_mix_cpx.wdo}
|
||||
view wave
|
||||
view structure
|
||||
view signals
|
||||
run 1000ns
|
||||
## End
|
||||
@@ -0,0 +1,34 @@
|
||||
onerror {resume}
|
||||
quietly WaveActivateNextPane {} 0
|
||||
add wave -noupdate -format Logic /tb_syn_mix_cpx/clk
|
||||
add wave -noupdate -format Logic /tb_syn_mix_cpx/srst
|
||||
add wave -noupdate -format Logic /tb_syn_mix_cpx/in_valid
|
||||
add wave -noupdate -format Literal /tb_syn_mix_cpx/x_re_in
|
||||
add wave -noupdate -format Literal /tb_syn_mix_cpx/x_im_in
|
||||
add wave -noupdate -format Literal /tb_syn_mix_cpx/y_re_in
|
||||
add wave -noupdate -format Literal /tb_syn_mix_cpx/y_im_in
|
||||
add wave -noupdate -format Literal /tb_syn_mix_cpx/z_re_out
|
||||
add wave -noupdate -format Literal /tb_syn_mix_cpx/z_im_out
|
||||
add wave -noupdate -format Logic /tb_syn_mix_cpx/out_valid
|
||||
add wave -noupdate -format Literal /tb_syn_mix_cpx/x_re
|
||||
add wave -noupdate -format Literal /tb_syn_mix_cpx/x_im
|
||||
add wave -noupdate -format Literal /tb_syn_mix_cpx/y_re
|
||||
add wave -noupdate -format Literal /tb_syn_mix_cpx/y_im
|
||||
add wave -noupdate -format Literal /tb_syn_mix_cpx/z_re
|
||||
add wave -noupdate -format Literal /tb_syn_mix_cpx/z_im
|
||||
TreeUpdate [SetDefaultTree]
|
||||
WaveRestoreCursors {{Cursor 1} {0 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 {0 ps} {1 ns}
|
||||
@@ -0,0 +1,14 @@
|
||||
## NOTE: Do not edit this file.
|
||||
## Auto generated by Project Navigator for Post-Translate Simulation
|
||||
##
|
||||
vlib work
|
||||
## Compile Post-Translate Model
|
||||
vcom -explicit -93 "../syn/nco/netgen/synthesis/syn_nco_synthesis.vhd"
|
||||
vcom -explicit -93 "../src/tb_syn_nco.vhd"
|
||||
vsim -t 1ps -lib work tb_syn_nco
|
||||
do {tb_syn_nco.wdo}
|
||||
view wave
|
||||
view structure
|
||||
view signals
|
||||
run 10us
|
||||
## End
|
||||
@@ -0,0 +1,33 @@
|
||||
onerror {resume}
|
||||
quietly WaveActivateNextPane {} 0
|
||||
add wave -noupdate -format Literal /tb_syn_nco/freq_word
|
||||
add wave -noupdate -format Literal /tb_syn_nco/dfreq_word
|
||||
add wave -noupdate -format Logic /tb_syn_nco/clk
|
||||
add wave -noupdate -format Logic /tb_syn_nco/srst
|
||||
add wave -noupdate -format Logic /tb_syn_nco/pacc_clr
|
||||
add wave -noupdate -format Logic /tb_syn_nco/pacc_inc
|
||||
add wave -noupdate -format Logic /tb_syn_nco/phase_load
|
||||
add wave -noupdate -format Logic /tb_syn_nco/freq_load
|
||||
add wave -noupdate -format Literal -radix decimal /tb_syn_nco/freq_in
|
||||
add wave -noupdate -format Literal -radix decimal /tb_syn_nco/phase_in
|
||||
add wave -noupdate -format Analog-Step -radix decimal -scale 0.004884004884004884 /tb_syn_nco/wave_out_i
|
||||
add wave -noupdate -format Analog-Step -radix decimal -scale 0.004884004884004884 /tb_syn_nco/wave_out_q
|
||||
add wave -noupdate -format Logic /tb_syn_nco/out_valid
|
||||
add wave -noupdate -format Analog-Step -radix decimal -scale 0.00030518043793392844 /tb_syn_nco/phase_out
|
||||
add wave -noupdate -format Logic /tb_syn_nco/fileout_enable
|
||||
TreeUpdate [SetDefaultTree]
|
||||
WaveRestoreCursors {{Cursor 1} {4737111 ps} 0}
|
||||
configure wave -namecolwidth 193
|
||||
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 1
|
||||
configure wave -griddelta 40
|
||||
configure wave -timeline 0
|
||||
update
|
||||
WaveRestoreZoom {4171440 ps} {5483940 ps}
|
||||
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
function wav2in(name)
|
||||
|
||||
x = wavread(name)*(2^15);
|
||||
|
||||
fid = fopen('wav_in.dat', 'w');
|
||||
fwrite(fid, fix(x), 'int');
|
||||
fclose(fid);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user