mcutofpga.vhd

来自「msp430驱动340*240程序 包括显示图片 文字 以及一些改变字体颜色功能」· VHDL 代码 · 共 33 行

VHD
33
字号
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

entity McuToFpga is
	generic(QWidth : Integer := 24);	--移位寄存器的宽度
	port(
		CLK: in std_logic;				--同步时钟,上升研写入数据
		DATA: in std_logic;				--串行数据端口,先发低位然后高位
		EN: in std_logic;				--使能端,高电平开始传输,同步方式 
		frep: out std_logic_vector(14 downto 0);
		phase: out std_logic_vector(8 downto 0)	
		);
end;		

architecture behav of McuToFpga is 
signal Qtmp: std_logic_vector(QWidth-1 downto 0):=(others=>'0');
begin
	process(CLK,EN,DATA)
	begin
		if(CLK'event and CLK='1') then
			if(EN = '1') then
				Qtmp(23) <=DATA;
				Qtmp(22 downto 0) <= Qtmp(23 downto 1);
			else
				Qtmp<=Qtmp;
			end if;
	   	end if;
	end process;  
	frep<=Qtmp(14 downto 0);
	phase<=Qtmp(23 downto 15);
	
end;

⌨️ 快捷键说明

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