LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY DDS IS -- ¶¥2ãéè¼Æ
PORT ( CLK : IN STD_LOGIC;
DA_CLK: OUT STD_LOGIC;
FWORD : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
FOUT : OUT STD_LOGIC_VECTOR(9 DOWNTO 0) );
END;
ARCHITECTURE one OF DDS IS
COMPONENT REG32B
PORT ( LOAD : IN STD_LOGIC;
DIN : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
DOUT : OUT STD_LOGIC_VECTOR(31 DOWNTO 0) );
END COMPONENT;
COMPONENT REG10B
PORT ( LOAD : IN STD_LOGIC;
DIN : IN STD_LOGIC_VECTOR(9 DOWNTO 0);
DOUT : OUT STD_LOGIC_VECTOR(9 DOWNTO 0) );
END COMPONENT;
COMPONENT ADDER32B
PORT ( A : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
B : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
S : OUT STD_LOGIC_VECTOR(31 DOWNTO 0) );
END COMPONENT;
COMPONENT ADDER10B
PORT ( A : IN STD_LOGIC_VECTOR(9 DOWNTO 0);
B : IN STD_LOGIC_VECTOR(9 DOWNTO 0);
S : OUT STD_LOGIC_VECTOR(9 DOWNTO 0) );
END COMPONENT;
COMPONENT SIN_ROM
PORT ( address : IN STD_LOGIC_VECTOR(9 DOWNTO 0);
clock : IN STD_LOGIC ;
q : OUT STD_LOGIC_VECTOR(9 DOWNTO 0) );
END COMPONENT;
SIGNAL F32B : STD_LOGIC_VECTOR(31 DOWNTO 0);
SIGNAL D32B : STD_LOGIC_VECTOR(31 DOWNTO 0);
SIGNAL DIN32B : STD_LOGIC_VECTOR(31 DOWNTO 0);
SIGNAL P10B : STD_LOGIC_VECTOR( 9 DOWNTO 0);
SIGNAL LIN10B : STD_LOGIC_VECTOR( 9 DOWNTO 0);
SIGNAL SIN10B : STD_LOGIC_VECTOR( 9 DOWNTO 0);
SIGNAL PWORD : STD_LOGIC_VECTOR(7 DOWNTO 0);
BEGIN
DA_CLK<=CLK;
F32B(22 DOWNTO 15)<=FWORD ; F32B(31 DOWNTO 23)<="000000000"; P10B( 1 DOWNTO 0)<="00" ;
F32B(14 DOWNTO 0)<="000000000000000" ; P10B( 9 DOWNTO 2)<=PWORD ; PWORD <="01100100";
u1 : ADDER32B PORT MAP( A=>F32B,B=>D32B, S=>DIN32B );
u2 : REG32B PORT MAP( DOUT=>D32B,DIN=>DIN32B, LOAD=>CLK );
u3 : SIN_ROM PORT MAP( address=>SIN10B, q=>FOUT, clock=>CLK );
u4 : ADDER10B PORT MAP( A=>P10B,B=>D32B(31 DOWNTO 22),S=>LIN10B );
u5 : REG10B PORT MAP( DOUT=>SIN10B,DIN=>LIN10B, LOAD=>CLK );
END;
这是我写的dds的程序,现在想写一个tb程序,在modelsim中仿真出来正弦波形。
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity dds_tb is
end dds_tb;
architecture first of dds_tb is
component dds is
PORT ( CLK : IN STD_LOGIC;
DA_CLK: OUT STD_LOGIC;
FWORD : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
FOUT : OUT STD_LOGIC_VECTOR(9 DOWNTO 0) );
end component;
signal clk :std_logic:='0';
signal da_clk :std_logic:='0';
signal fword:std_logic_vector(7 downto 0):="00000001";
signal fout:std_logic_vector(9 downto 0):="0000000000";
constant clk_period
=20 ns;
begin
u1:
dds port map
(clk=>clk,da_clk=>da_clk,fword=>fword,fout=>fout);
process
begin
wait for clk_period/2;
clk<='1';
wait for clk_period/2;
clk<='0';
end process;
end;
这里面要加些什么东西?我自己找的原因是后面无法累加。地址不能变。
此帖出自
小平头技术问答
没人来回答。多谢顶贴
一周热门 更多>