- 78
- 0
- 约8.28千字
- 约 15页
- 2016-08-01 发布于湖北
- 举报
数字系统设计实验---32位串行加法器实验
深 圳 大 学 实 验 报 告
课程名称: 数字系统设计
实验项目名称: 32位串行加法器
学院: 信息工程学院
专业: 电子信息工程
指导教师:
报告人: 学号:20091000000 班级: 1班
实验时间: 2011-12-4
实验报告提交时间: 2011-12-10
教务处制
一、实验目的与要求:
实验目的:
掌握串行加法器的原理和设计。
熟悉VHDL状态机的设计。
学会分析波形图。
实验要求:
设计一个用一个1位加法器构建的一个32位串行加法器。
重点是算法状态机的实现还有系统的时序分析;输出和整理VHDL源代码;输出和整理电路结构图;输出和整理仿真波形图 二、实验原理
1、设计原理图:本图参考课本
2、流程图:
针对以上流程图,其中,Sh为控制移位寄存器的使能信号,k为工作状态指示信号,load为加载信号,counter为运算计数器,N为系统工作控制信号。从流程图中可以看出加法器的整个工作流程是怎么样子的,具体工作情况如下面的设计。
三、实验内容与步骤
1、VHDL代码的编写:
------------------控制器-------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.std_logic_unsigned.all;
entity controller is
Port ( clk : in STD_LOGIC;
N : in STD_LOGIC;
K,Sh,load : out STD_LOGIC);
end controller;
architecture Behavioral of controller is
signal state,nextstate:integer range 0 to 2; ---设置状态
signal counter:std_logic_vector(4 downto 0);
begin
process(clk)
begin
if(clkevent and clk=1) then
state=nextstate; ---上升沿触发启动
end if;
end process;
process(clk,N)
begin
if(clkevent and clk=1) then
case state is ---设置各状态
when 0 =
sh=0;K=0;load=0;counter=00000;
if N=1 then
load=1;
nextstate=1;
else
nextstate=0;
end if;
when 1 =
sh=1;K=0;load=0;
if counter=11110 then
counter=counter+1;
nextstate=2;
else
counter=counter+1;
nextstate=1;
end if;
when 2 =
sh=0;K=1;load=0;
if N=0 then
nextstate=0;
else
nextstate=2;
end if;
end case;
end if;
end process;
end Behavioral;
---------------------加数寄存器------------------------
library IEEE;
use IEEE.STD_LOGIC_116
原创力文档

文档评论(0)