ImageVerifierCode 换一换
格式:DOCX , 页数:20 ,大小:316.99KB ,
资源ID:1759733      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bingdoc.com/d-1759733.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(16位模型机的设计.docx)为本站会员(b****1)主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(发送邮件至service@bingdoc.com或直接QQ联系客服),我们立即给予删除!

16位模型机的设计.docx

1、16位模型机的设计16位CPU的设计要求:此模型机的功能是将存储区的数据块复制到另一个存储区。汇编代码如下: START: LOADI R1,0010H ;源操作数地址送R1LOADI R2,0030H ;目的操作数地址送R2LOADI R6,002FH ;结束地址送R6NEXT: LOAD R3,R1 ;取数STORE R2,R3 ;存数BRANCHGTI START ;如果R1R6,则转向STARTINC R1 ;修改源地址INC R2 ;修改目的地址BRANCHI NEXT ;转向NEXT1. 16位CPU的组成结构2. 指令系统的设计一、 指令格式1) 单字指令格式2) 双字指令格式二

2、、 指令操作码操作码指令功能00001LOAD装载数据到寄存器00010STORE将寄存器的数据存入到存储器00100LOADI将立即数装入到寄存器00101BRANCHI无条件转移到由立即数指定的地址00110BRANCHGTI如果源寄存器容大于目的寄存器的容,则转移到由立即数指定的地址00111INC寄存器容加1指令依据以上设计的指令系统,则完成数据块复制的程序如下:地址机器码指令 功能说明0000H0001H2001H0010HLOADI R1,0010H源操作数地址送R10002H0003H2002H0030HLOADI R2,0030H目的操作数地址送R20004H0005H2006

3、H002FHLOADI R6,002FH结束地址送R60006H080BHLOAD R3,R1取数0007H101AHSTORE R2,R3存数0008H 0009H300EH0000HBRANCHGTI 0000如果R1大于R6,则转向地址0000000AH3801HINC R1修改源地址000BH3802HINC R2修改目的地址000CH000DH2800H0006HBRANCHI 0006H转向00006H,实现循环3. VHDL设计一、 程序包:说明运算器的功能、移动寄存器的操作、比较器的比较类型和用于CPU控制的状态类型。library ieee;use ieee.std_logi

4、c_1164.all;use ieee.std_logic_arith.all;package cpu_lib is subtype t_shift is unsigned (3 downto 0);constant shftpass :unsigned(3 downto 0):=0000;constant sftl :unsigned(3 downto 0):=0001;constant sftr:unsigned(3 downto 0):=0010;constant rotl :unsigned(3 downto 0):=0011;constant rotr :unsigned(3 dow

5、nto 0):=0100;subtype t_alu is unsigned(3 downto 0);constant alupass :unsigned(3 downto 0):=0000;constant andOp :unsigned(3 downto 0):=0001;constant orOp:unsigned(3 downto 0):=0010;constant notOp :unsigned(3 downto 0):=0011;constant xorOp :unsigned(3 downto 0):=0100;constant plus :unsigned(3 downto 0

6、):=0101;constant alusub :unsigned(3 downto 0):=0110;constant inc :unsigned(3 downto 0):=0111;constant dec :unsigned(3 downto 0):=1000;constant zero:unsigned(3 downto 0):=1001;subtype t_comp is unsigned 2 downto 0);constant eq :unsigned(2 downto 0):=000;constant neq :unsigned(2 downto 0):=001;constan

7、t gt:unsigned(2 downto 0):=;constant gte :unsigned(2 downto 0):=011;constant lt :unsigned(2 downto 0):=100;constant lte :unsigned(2 downto 0):=101;subtype t_reg is std_logic_vector(2 downto 0);type state is (reset1,reset2,reset3,reset4,reset5,reset6,execute,nop,load,store,move,load2,load3,load4,stor

8、e2,store3,store4,move2,move3,move4,incPc,incPc2,incPc3,incPc4,incPc5,incPc6,loadPc,loadPc2,loadPc3,loadPc4,bgtI2,bgtI3,bgtI4,bgtI5,bgtI6,bgtI7,bgtI8,bgtI9,bgtI10,braI2,braI3,braI4,braI5,braI6,loadI2,loadI3,loadI4,loadI5,loadI6,inc2,inc3,inc4);subtype bit16 is std_logic_vector(15 downto 0);end cpu_li

9、b;二、基本部件的设计1) 运算器的设计 功能library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use work.cpu_lib.all;entity alu is port(a,b:in bit16;sel:in t_alu;c:out bit16);end alu;architecture rt1 of alu is begin process(a,b,sel)begincase sel iswhen alupass= c c c c c c c c c c c if a=b then comp

10、out =1 after 1ns; else compout if a/=b then compout =1 after 1ns; else compout if ab then compout =1 after 1ns; else compout if a=b then compout =1 after 1ns; else compout if ab then compout =1 after 1ns; else compout if a=b then compout =1 after 1ns; else compout compout y y y y y y=000000000000000

11、0 after 1 ns;end case;end process;end rt1;4) 寄存器library ieee;use ieee.std_logic_1164.all;use work.cpu_lib.all;entity reg is port(a:in bit16;clk:in std_logic;q:out bit16);end reg;architecture rt1 of reg isbeginprocessbeginwait until clkevent and clk=1;q=a after 1ns;end process;end rt1;5) 寄存器组library

12、ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use work.cpu_lib.all;entity regarray is port(data:in bit16;sel:in t_reg;en,clk:in std_logic;q:out bit16);end regarray;architecture rt1 of regarray is type t_ram is array (0 to 7) of bit16;signal temp_data:bit16;beginprocess(clk,sel) va

13、riable ramdata:t_ram;begin if clkevent and clk=1 then ramdata(conv_integer(sel):=data; end if; temp_data=ramdata(conv_integer(sel) after 1 ns;end process;process(en,temp_data)begin if en=1 then q=temp_data after 1 ns; else q=ZZZZZZZZZZZZZZZZ after 1 ns; end if;end process;end rt1;6) 三态寄存器library iee

14、e;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use work.cpu_lib.all;entity trireg isport(a:in bit16;en,clk:in std_logic;q:out bit16);end trireg;architecture rt1 of trireg issignal val:bit16;beginprocess begin wait until clkevent and clk=1; val=a; end process;process(en,val)begin if en

15、=1 then q=val after 1 ns; elsif en=0 then q=ZZZZZZZZZZZZZZZZ after 1 ns; else q=XXXXXXXXXXXXXXXX after 1 ns; end if;end process;end rt1;7) 控制器采用状态机实现library IEEE;use IEEE.std_logic_1164.all;use work.cpu_lib.all;entity control is port( clock,reset,compout:in std_logic; instrReg:in bit16; progCntrWr,p

16、rogCntrRd,addrRegWr,outRegWr,outRegRd:out std_logic; shiftSel:out t_shift; aluSel:out t_alu; compSel:out t_comp; opRegRd,opRegWr,instrWr,regRd,regWr,rw,vma:out std_logic; regSel:out t_reg );end control;architecture rtl of control is signal current_state, next_state : state; begin process( current_st

17、ate, instrReg, compout) begin progCntrWr = 0; progCntrRd = 0; addrRegWr = 0; outRegWr = 0;outRegRd = 0; shiftSel = shftpass; aluSel = alupass; compSel = eq;opRegRd = 0; opRegWr = 0; instrWr = 0; regSel = 000;regRd = 0; regWr = 0; rw = 0; vma aluSel=zero after 1 ns; shiftSel=shftpass; next_state aluS

18、el=zero; shiftSel=shftpass; outRegWr=1; next_state outRegRd=1; next_state outRegRd=1; progCntrWr=1;addrRegWr=1; next_state vma=1; rw = 0; next_state vma=1; rw=0;instrWr=1; next_state case instrReg(15 downto 11) is when 00000 = next_state regSel=instrReg(5 downto 3); regRd=1;next_state regSel=instrRe

19、g(2 downto 0); regRd=1;next_state regSel=instrReg(5 downto 3); regRd=1; aluSel=alupass;shiftSel=shftpass; next_state progcntrRd=1; alusel=inc; shiftsel=shftpass;next_state progcntrRd=1; alusel=inc; shiftsel=shftpass;next_state regSel=instrReg(5 downto 3); regRd=1;next_state regSel=instrReg(2 downto

20、0); regRd=1; alusel=inc;shiftsel=shftpass; next_statenext_state regSel = instrReg(5 downto 3); regRd = 1;addrregWr = 1; next_state vma = 1; rw = 0; next_state vma = 1; rw = 0; regSel = instrReg(2 downto 0);regWr = 1; next_state regSel = instrReg(2 downto 0); regRd = 1;addrregWr = 1; next_state regSe

21、l = instrReg(5 downto 3); regRd = 1;next_state regSel = instrReg(5 downto 3); regRd = 1; rw = 1; next_state regSel = instrReg(5 downto 3); regRd = 1;aluSel =alupass;shiftsel = shftpass; outRegWr = 1; next_state outRegRd = 1; next_state outRegRd = 1;regSel = instrReg(2 downto 0); regWr = 1; next_stat

22、e progcntrRd = 1; alusel = inc; shiftsel = shftpass;outregWr = 1; next_state outregRd = 1; next_state outregRd = 1; progcntrWr=1; addrregWr=1;next_state vma = 1; rw = 0; next_state vma = 1; rw = 0;regSel = instrReg(2 downto 0);regWr = 1; next_state progcntrRd = 1; alusel = inc; shiftsel = shftpass;outregWr = 1; next_state outregRd = 1; next_state = braI4;wh

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2