±±¾©Óʵç´óѧÊý×Öµç·ÓëÂß¼Éè¼ÆÊµÑ鱨¸æ
¸ù¾Ý²¨ÐÎͼ¿ÉÒÔ¿´³ö״̬»úµÄÔËÐУ¬ÆäÖÐÒ»¸ö״̬ռÁ½¸öʱÖÓÖÜÆÚ¡£
¸Ã·ÂÕæÏ൱ÓÚCPUÖ´ÐÐÖ¸ÁîµÄʱÐòͼ£¬·´Ó³Á˳ÌÐòÔËÐÐÇé¿ö¡£»¹°üÀ¨ÁËշתÏà¼õ·¨µÄ·ÂÕæ£¬ºÍrstµÄÇåÁã·ÂÕæ¡£¿ÉÒÔ¿´³ö¸ÃCPUϵͳµÄ·ÂÕæ½á¹ûÕýÈ·£¬´ïµ½ÏÂÔØµÄÒªÇó¡£
±±¾©Óʵç´óѧÊý×Öµç·ÓëÂß¼Éè¼ÆÊµÑ鱨¸æ
4 Ô´³ÌÐò£¨º¬×¢ÊÍ£©
¸÷¸ö²¿¼þ¶ÔÓ¦µÄÔ´³ÌÐòÈçÏ£¨×îºóµÄÁ¬½ÓÊÇÓÃͼÐÎÁ¬½ÓÍê³ÉµÄ£©£º
4.1 DIV(·ÖƵÆ÷)
library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all;
entity DIV is port (
clk_in:in std_logic; clk_out1:out std_logic; clk_out2:out std_logic ); end DIV;
±±¾©Óʵç´óѧÊý×Öµç·ÓëÂß¼Éè¼ÆÊµÑ鱨¸æ
architecture behave of DIV is
signal tmp:std_logic_vector(15 downto 0); begin
process(clk_in,tmp) begin
if(clk_in'event and clk_in='1')then tmp<=tmp+1; end if;
clk_out1<=tmp(0); clk_out2<=tmp(1); end process; end behave;
4.2 MCU (¿ØÖÆÆ÷)
library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all;
entity MCU is
±±¾©Óʵç´óѧÊý×Öµç·ÓëÂß¼Éè¼ÆÊµÑ鱨¸æ
port (
clk:in std_logic; start:in std_logic;
opcode:in std_logic_vector(3 downto 0); cmp:in std_logic;
ctr:out std_logic_vector(10 downto 0) ); end MCU;
architecture behave of MCU is begin
process(clk,start)
variable status:std_logic_vector(4 downto 0):=\begin
if(start='1')then status:=\ elsif(clk'event and clk='1')then case status is
when\ --MBR<-RAM
when\