⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aluuva16b.do

📁 16bit 定点DSP。是很精练的例子
💻 DO
字号:
echo
echo
echo #########################################
echo " Simulation Script 'ALUuva16b' using ModelSimXE 5.3d   #"
echo " v010411  Ok  Santiago de Pablo (sanpab@eis.uva.es)   #"
echo #########################################
echo

-- Test of Arithmetic ALU.

restart -force
delete wave -r *
radix hexadecimal
echo

add wave Clk
add wave Phase
add wave InA
add wave InB
--add wave InC
add wave OpCode
add wave FlagIn
--add wave OutMAC
--add wave OutLogic
add wave OutArith
add wave Vflag

add wave OpA
add wave OpB
add wave AddA
add wave AddB

echo

-- Global signals

force Clk 1 0ns, 0 50ns -repeat 100ns
force Phase 0 15ns, 1 115ns, 3 215 ns, 2 315 ns -repeat 400ns

-- Initialize

force	FlagIn	0		0ns
force	OpCode	16#F		0ns
force	InA	16#FFFF00	0ns
force	InB	16#FFFF00	0ns
run 300ns



----------------------------------
-- Tests "if (flag) rT else rD" --
----------------------------------

force	OpCode	16#8		15ns


-- 0x53A2 (+0'6533) vs 0x6B1F (+0'8368) with '1' => 0x6B1F ok

force	InA	16#53A200	15ns
force	InB	16#6B1F00	15ns
force	FlagIn	1		15ns

run 150ns
echo "$now ns: OutArith is 0x[examine -hex OutArith] vs 0x6b1f00."
run 250ns


-- 0x53A2 (+0'6533) vs 0x6B1F (+0'8368) with '0' => 0x53a2 ok

force	FlagIn	0		15ns

run 150ns
echo "$now ns: OutArith is 0x[examine -hex OutArith] vs 0x53a200."
run 250ns



-----------------------------------
-- Tests "if (flag) -rT else rD" --
-----------------------------------

force	OpCode	16#9		15ns


-- 0x6B1F (+0'8368) vs 0x53A2 (+0'6533) with '1' => 0xAC5E (-0,6533) ok

force	InA	16#6B1F00	15ns
force	InB	16#53A200	15ns
force	FlagIn	1		15ns

run 150ns
echo "$now ns: OutArith is 0x[examine -hex OutArith] vs 0xac5e00."
run 250ns


-- 0x6B1F (+0'8368) vs 0x53A2 (+0'6533) with '0' => 0x6B1f ok

force	FlagIn	0		15ns

run 150ns
echo "$now ns: OutArith is 0x[examine -hex OutArith] vs 0x6b1f00."
run 250ns



---------------------
-- Tests "rS + rT" --
---------------------

force	OpCode	16#A		15ns


-- 0x53A2 (+0'6533) + 0x6B1F (+0'8368) = 0xBEC1(V!) (+1,4903) ok

force	InA	16#53A200	15ns
force	InB	16#6B1F00	15ns

run 150ns
echo "$now ns: OutArith is 0x[examine -hex OutArith] vs 0xbec100."
echo "$now ns: Vflag is '[examine -hex Vflag]' vs '1'."
run 250ns


-- 0xDB1F (-0'2881) + 0x53A2 (+0'6533) = 0x2EC100 (0,3653) ok

force	InA	16#DB1F00	15ns
force	InB	16#53A200	15ns

run 150ns
echo "$now ns: OutArith is 0x[examine -hex OutArith] vs 0x2ec100."
echo "$now ns: Vflag is '[examine -hex Vflag]' vs '0'."
run 250ns


-- 0x53A2 (+0'6533) + 0xDB1F (-0'2881) = 0x2EC100 (0,3653) ok

force	InA	16#53A200	15ns
force	InB	16#DB1F00	15ns

run 150ns
echo "$now ns: OutArith is 0x[examine -hex OutArith] vs 0x2ec100."
echo "$now ns: Vflag is '[examine -hex Vflag]' vs '0'."
run 250ns


-- 0xDB1F (-0'2881) + 0xB3A2 (-0,5966) = 0x8EC100 (-0,8847) ok

force	InA	16#DB1F00	15ns
force	InB	16#B3A200	15ns

run 150ns
echo "$now ns: OutArith is 0x[examine -hex OutArith] vs 0x8ec100."
echo "$now ns: Vflag is '[examine -hex Vflag]' vs '0'."
run 250ns


---------------------
-- Tests "rS - rT" --
---------------------

force	OpCode	16#B		15ns


-- 0x53A2 (+0'6533) - 0x6B1F (+0'8368) = 0xE883 (-0,1835) ok

force	InA	16#53A200	15ns
force	InB	16#6B1F00	15ns

run 150ns
echo "$now ns: OutArith is 0x[examine -hex OutArith] vs 0xe88300."
echo "$now ns: Vflag is '[examine -hex Vflag]' vs '0'."
run 250ns


-- 0xDB1F (-0'2881) - 0x53A2 (+0'6533) = 0x877D00 (-0,9415) ok

force	InA	16#DB1F00	15ns
force	InB	16#53A200	15ns

run 150ns
echo "$now ns: OutArith is 0x[examine -hex OutArith] vs 0x877d00."
echo "$now ns: Vflag is '[examine -hex Vflag]' vs '0'."
run 250ns


-- 0x53A2 (+0'6533) - 0xDB1F (-0'2881) = 0x788300 (+0,9415) ok

force	InA	16#53A200	15ns
force	InB	16#DB1F00	15ns

run 150ns
echo "$now ns: OutArith is 0x[examine -hex OutArith] vs 0x788300."
echo "$now ns: Vflag is '[examine -hex Vflag]' vs '0'."
run 250ns


-- 0xDB1F (-0'2881) - 0xB3A2 (-0,5966) = 0x277D00 (+0,3085) ok

force	InA	16#DB1F00	15ns
force	InB	16#B3A200	15ns

run 150ns
echo "$now ns: OutArith is 0x[examine -hex OutArith] vs 0x277d00."
echo "$now ns: Vflag is '[examine -hex Vflag]' vs '0'."
run 250ns


echo
echo All lines above must match.

-- End of file --

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -