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

📄 pc.vhd

📁 实现简单CPU功能的源码
💻 VHD
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

ENTITY PC IS
	PORT
	(	mbr_in	:  IN  std_logic_vector(7 downto 0);  --MBR[15..8]
        cs      :  IN  std_logic_vector(31 downto 0);
		clk     :  IN  std_logic;
        pc_out  :  OUT std_logic_vector(7 downto 0)
    );
END PC;

ARCHITECTURE behave OF PC IS
  BEGIN
	PROCESS(clk)
        variable temp:std_logic_vector(7 downto 0);
		BEGIN
			if clk'event and clk='1' then
			   if cs(20)='1' THEN   --reset
				  temp:="00000000";
			   elsif cs(18)='1' then  --MBR to PC
					temp:=mbr_in;
			   elsif cs(19)='1' then  --increment
					temp:=temp+1;
			   end if;
            pc_out<=temp;
			END IF;       
	END PROCESS;
END behave;


⌨️ 快捷键说明

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