1、定制LPM_ROM,1.File-New,2.选择ROM的字数和位数,字数位数,3.在mif表中输入正弦波数据,4.用另存为命令Save As,此处勾去掉,用c语言生成mif文件,源程序存为“SIN_ROM.C”,开始菜单运行, 输入cmd, 进入dos方式,输入CD C:turboc2, 回车,再输入sin_rom sin_rom.mif, 回车,用文本方式打开该文件,WIDTH = 8; DEPTH =1024; ADDERSS_RADIX = HEX; DATA_RADIX =HEX; CONTENT BEGIN,在该文件开头添加,END;,在该文件结尾添加,LIBRARY IEEE;
2、USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY singt ISPORT (CLK: IN STD_LOGIC; dout : OUT STD_LOGIC_VECTOR(7 DOWNTO 0) ); END singt; ARCHITECTURE behav OF singt IS component data_romPORT(address: IN STD_LOGIC_VECTOR (5 DOWNTO 0);clock : IN STD_LOGIC ;q: OUT STD_LOGIC_VECTOR (7 DOWNTO 0);end component; signal q1:STD_LOGIC_VECTOR(5 DOWNTO 0); signal q2:integer; signal clk1: std_logic; begin,process(clk) begin if clkevent and clk=1 then if q2=50000 then q2q1,q=dout,clock=clk); end behav;,