华南农业大学信息学院
设计性、综合性实验
实验项目名称: 计算机组成原理综合设计
实验项目性质: 综合性、设计性实验
所属课程名称: 计算机组成原理
开 设 时 间: 2009学年第一学期
一、实验目的
通过对简单微指令控制器的设计与实现,使抽象的理论原理在实践中得到应用,由此巩固学习内容。
二、实验内容
按照实验原理图设计并实现一个微型指令控制器,主要实现地址转换,指令储存等功能。
详细设计
本微指令控制器由微指令寄存器和地址转移逻辑等几个部件组成,控制存储器用来存放实现全部指令系统的微程序;微指令寄存器用来存放由控制存储器读出的一条微指令信息,其中微地址寄存器决定将要访问的下一条微指令的地址,而微命令寄存器则保存一条微指令的操作控制字段和判别测试字段的信息。最后地址转移逻辑用于根据从微指令中读出的P字段来判断下一条微指令的地址,承担自动完成修改微地址的任务。
分别使用寄存器,控制存储器,逻辑转移指令,节拍发生器等部件实现。
//地址寄存器
library ieee;
use ieee.std_logic_1164.all;
entity addr_logic is
port(p_segment,op : in std_logic_vector(1 downto 0);
get_op,clk : in std_logic;
addr_out : out std_logic_vector(1 downto 0));
end addr_logic;
architecture addrlogic of addr_logic is
begin
process(p_segment,op,get_op,clk)
begin
if rising_edge(clk) then
if get_op='1' then
addr_out<=op;
end if;
end if;
end process;
end addrlogic;
//计时器
library ieee;
use ieee.std_logic_1164.all;
entity pulse is
port(clk,clr : in std_logic;
t : out std_logic_vector(4 downto 1));
end pulse;
architecture s_pulse of pulse is
component wdff is
port(d,clk,r,s : in std_logic;
q,nq : out std_logic);
end component;
signal c,nc : std_logic_vector(4 downto 1);
signal cp,nclk,rr : std_logic;
begin
nclk<=not clk;
c4 : wdff port map(c(3),nclk,'1',clr,c(4),nc(4));
cp<=not (nclk and nc(4));
rr<=not (clk and c(4));
c1 : wdff port map('1',cp,rr,'1',c(1),nc(1));
c2 : wdff port map(c(1),cp,rr,'1',c(2),nc(2));
c3 : wdff port map(c(2),cp,rr,'1',c(3),nc(3));
t(1)<=c(1) and nc(2);
t(2)<=c(2) and nc(3);
t(3)<=c(3);
t(4)<=nc(1);
end s_pulse;
//总控制器
library ieee;
use ieee.std_logic_1164.all;
entity add is
port(addin : in std_logic_vector(3 downto 0);
clk : in std_logic;
addout : out std_logic_vector(3 downto 0));
end add;
architecture s_add of add is
component wdff is
port(d,clk,r,s : in std_logic;
q,nq : out std_logic);
end component;
begin
w1: wdff port map(addin[0],clk,1,1,addou