一、目的:
完整、连贯地运用《数字逻辑》所学到的知识,熟练掌握 EDA 工具基本使用方法,为学习好后续《计算机原理》课程做铺垫。
二、设计内容
(一) 按照给定的数据通路、数据格式和指令系统,使用 EDA 工具设计一台用硬连线
逻辑控制的简易计算机;
(二) 要求灵活运用各方面知识,使得所设计的计算机具有较佳的性能;
(三) 对所设计计算机的性能指标进行分析,整理出设计报告。
三、详细设计
用VHDL语言设计的ZF
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity Zf is
port (X, EN,clk:in std_logic;
Zf:out std_logic) ;
end entity;
architecture bhv of Zf is
begin
process (CLK, EN)
begin
if(EN='1') then
if (CLK'event and CLK='0') then Zf<=X;--down side and EN=0
end if;
end if;
end process;
end architecture;
RTL视图
用VHDL语言设计的CF
library ieee;
use ieee.std_logic_1164.all ;
use ieee.std_logic_unsigned.all;
entity Cf is
port (X,EN,clk:in std_logic;
cf:out std_logic) ;
end entity;
architecture bhv of Cf is
begin
process (CLK, EN)
begin
if(EN='1' )then
if(CLK'event and CLK='0' ) then Cf<=X;--down side
end if;
end if;
end process ;
end architecture;
RTL视图
用VHDL语言设计的IR
library ieee;
use ieee.std_logic_1164.all;
entity IR is
port(input:in std_logic_vector(7 downto 0);
clock,ld:in std_logic;
output_a,output_b:out std_logic_vector(3 downto 0);
R:out std_logic_vector(7 downto 0));
end IR;
architecture bhv of IR is
signal i:std_logic_vector(7 downto 0):="00000000";
begin
process (clock,input,ld)
begin
if(clock'event and clock='0') then--rising clock .
if(ld='1') then i<=input;
end if;
end if;
end process;
output_a<=i(7 downto 4);
output_b<=i(3 downto 0);
R<=i;
end bhv;
RTL视图
CPU的设计我采用的是分层设计的方法。
最顶层的设计如图:
func部分如图:
decoder部分如图:
zhiling部分如图: