- Intital revision

git-svn-id: http://moon:8086/svn/vhdl/trunk@139 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
2008-12-21 16:18:22 +00:00
parent 8e6affa627
commit 776094e4b2
24 changed files with 4752 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
% function eval_cordic(x0,y0,z0, mode)
function eval_cordic(x0,y0,z0, mode)
if (mode == 'rot')
Xn = x0*cos(z0) - y0*sin(z0)
Yn = y0*cos(z0) + x0*sin(z0)
else
Xn = sqrt(x0^2 + y0^2)
Yn = z0 + atan(y0/x0)
end;
@@ -0,0 +1,16 @@
vlib work
vcom -explicit -93 "../../../fixed/fixed_pkg_c.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 "../src/cordic_pkg.vhd"
vcom -explicit -93 "../src/cordic_pipe_stage.vhd"
vcom -explicit -93 "../src/cordic_pipe_pre.vhd"
vcom -explicit -93 "../src/cordic_pipe_post.vhd"
vcom -explicit -93 "../src/cordic_pipe_top.vhd"
vcom -explicit -93 "../src/tb_cordic_pipe_top.vhd"
vsim -t 1ps -lib work tb_cordic_pipe_top
do {tb_cordic_pipe_top.wdo}
view wave
view structure
view signals
run 2000us
@@ -0,0 +1,37 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate -format Logic /tb_cordic_pipe_top/clk
add wave -noupdate -format Logic /tb_cordic_pipe_top/rst
add wave -noupdate -format Logic /tb_cordic_pipe_top/vld_in
add wave -noupdate -format Literal -radix decimal /tb_cordic_pipe_top/xin
add wave -noupdate -format Literal -radix decimal /tb_cordic_pipe_top/yin
add wave -noupdate -format Literal -radix decimal /tb_cordic_pipe_top/zin
add wave -noupdate -format Literal -radix decimal /tb_cordic_pipe_top/xout
add wave -noupdate -format Literal -radix decimal /tb_cordic_pipe_top/yout
add wave -noupdate -format Literal -radix decimal /tb_cordic_pipe_top/zout
add wave -noupdate -format Logic /tb_cordic_pipe_top/vld_out
add wave -noupdate -divider {Pre stage}
add wave -noupdate -format Logic /tb_cordic_pipe_top/uut/inst_cordic_pipe_pre/vld_in
add wave -noupdate -format Logic /tb_cordic_pipe_top/uut/inst_cordic_pipe_pre/vld_out
add wave -noupdate -format Literal -radix decimal /tb_cordic_pipe_top/uut/inst_cordic_pipe_pre/xin
add wave -noupdate -format Literal -radix decimal /tb_cordic_pipe_top/uut/inst_cordic_pipe_pre/yin
add wave -noupdate -format Literal -radix decimal /tb_cordic_pipe_top/uut/inst_cordic_pipe_pre/zin
add wave -noupdate -format Literal -radix decimal /tb_cordic_pipe_top/uut/inst_cordic_pipe_pre/xout
add wave -noupdate -format Literal -radix decimal /tb_cordic_pipe_top/uut/inst_cordic_pipe_pre/yout
add wave -noupdate -format Literal -radix decimal /tb_cordic_pipe_top/uut/inst_cordic_pipe_pre/zout
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {10770000 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} {48466483 ps}
+17
View File
@@ -0,0 +1,17 @@
vlib work
vcom -explicit -93 "../../../fixed/fixed_pkg_c.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 "../src/cordic_pkg.vhd"
vcom -explicit -93 "../src/cordic_rom.vhd"
vcom -explicit -93 "../src/cordic_stage.vhd"
vcom -explicit -93 "../src/cordic_stage_pre.vhd"
vcom -explicit -93 "../src/cordic_stage_post.vhd"
vcom -explicit -93 "../src/cordic_top.vhd"
vcom -explicit -93 "../src/tb_cordic_top.vhd"
vsim -t 1ps -lib work tb_cordic_top
do {tb_cordic_top.wdo}
view wave
view structure
view signals
run 2000us
+64
View File
@@ -0,0 +1,64 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate -divider Top
add wave -noupdate -format Literal /tb_cordic_top/uut/cordic_mode
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/xin
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/yin
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/zin
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/xout
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/yout
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/zout
add wave -noupdate -format Logic /tb_cordic_top/ce
add wave -noupdate -format Logic /tb_cordic_top/valid
add wave -noupdate -divider {Pre stage}
add wave -noupdate -format Literal /tb_cordic_top/uut/inst_cordic_stage_pre/cordic_mode
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/uut/inst_cordic_stage_pre/xin
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/uut/inst_cordic_stage_pre/yin
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/uut/inst_cordic_stage_pre/zin
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/uut/inst_cordic_stage_pre/xout
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/uut/inst_cordic_stage_pre/yout
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/uut/inst_cordic_stage_pre/zout
add wave -noupdate -divider {Process stage}
add wave -noupdate -format Literal /tb_cordic_top/uut/count
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/uut/inst_cordic_stage/coeff
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/uut/inst_cordic_stage/xin
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/uut/inst_cordic_stage/yin
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/uut/inst_cordic_stage/zin
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/uut/inst_cordic_stage/xout
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/uut/inst_cordic_stage/yout
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/uut/inst_cordic_stage/zout
add wave -noupdate -divider {Post stage}
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/uut/inst_cordic_stage_post/xin
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/uut/inst_cordic_stage_post/yin
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/uut/inst_cordic_stage_post/zin
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/uut/inst_cordic_stage_post/xout
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/uut/inst_cordic_stage_post/yout
add wave -noupdate -format Literal -radix hexadecimal /tb_cordic_top/uut/inst_cordic_stage_post/zout
add wave -noupdate -divider Signals
add wave -noupdate -format Logic /tb_cordic_top/uut/ce
add wave -noupdate -format Logic /tb_cordic_top/uut/pre_stage_ready
add wave -noupdate -format Logic /tb_cordic_top/uut/pre_stage_en
add wave -noupdate -format Logic /tb_cordic_top/uut/pre_stage_valid
add wave -noupdate -format Logic /tb_cordic_top/uut/proc_stage_ready
add wave -noupdate -format Logic /tb_cordic_top/uut/proc_stage_en
add wave -noupdate -format Logic /tb_cordic_top/uut/proc_stage_valid
add wave -noupdate -format Logic /tb_cordic_top/uut/post_stage_ready
add wave -noupdate -format Logic /tb_cordic_top/uut/post_stage_en
add wave -noupdate -format Logic /tb_cordic_top/uut/post_stage_valid
add wave -noupdate -format Literal /tb_cordic_top/uut/state
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {1463518 ps} 0}
configure wave -namecolwidth 184
configure wave -valuecolwidth 124
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 {655140 ps} {1967644 ps}
+34
View File
@@ -0,0 +1,34 @@
% Read data
X = TEXTREAD('x.txt');
Y = TEXTREAD('y.txt');
Z = TEXTREAD('z.txt');
% Output
close all;
plot(0:length(X)-1, X, 0:length(Y)-1, Y, 0:length(Z)-1, Z);
title ('Output');
legend('X','Y','Z');
grid;
W= 2*pi/100;
phi = 0;
xd = -cos(phi+W*(0:length(X)-1))';
yd = -sin(phi+W*(0:length(Y)-1))';
VarErrorX = var(X-xd)
VarErrorY = var(Y-yd)
MeanErrorX = mean(X-xd)
MeanErrorY = mean(Y-yd)
figure;
plot(0:length(X)-1, X-xd, 0:length(Y)-1, Y-yd, 0:length(Z)-1, Z);
title ('Error');
legend('X - X_D','Y - Y_D', 'Z');
grid;
figure;
plot(0:length(X)-1, X, 0:length(Y)-1, Y, 0:length(Z)-1, xd, 0:length(yd)-1, yd);
title ('Output');
legend('X','Y','X_D','Y_D');
grid;