久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 3681|回復(fù): 0
收起左側(cè)

基于quartus 2 9.0c 軟件的MIPS指令集16位CPU設(shè)計(jì)

[復(fù)制鏈接]
ID:505284 發(fā)表于 2019-11-20 12:20 | 顯示全部樓層 |閱讀模式
  基于MIPS_RISC指令集的用VHDL語言寫的可以在quartus軟件運(yùn)行成功的16位cpu模型機(jī)源碼及CPU芯片邏輯技術(shù)設(shè)計(jì)書分享,以及全國大學(xué)生計(jì)算機(jī)設(shè)計(jì)大賽參考,本設(shè)計(jì)僅僅只是基礎(chǔ)設(shè)計(jì),滿足5條機(jī)器指令執(zhí)行,若需要更多要求,可以自行更改邏輯設(shè)計(jì)滿足不同要求。注意還有現(xiàn)成的設(shè)計(jì)原稿哦,文件大小限制,去繁從簡為主!

總體狀態(tài)轉(zhuǎn)換圖
0.jpg

畫出QuartusⅡ環(huán)境下的數(shù)據(jù)通路總圖

51hei.png

七、編寫匯編語言,調(diào)試程序,給出結(jié)果

為了方便輸入與編碼,指令格式自己譯成 操作碼/尋址方式/目的寄存器/源寄存器
51hei.png

總體仿真波形圖
51hei.png

1.ALU
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity ALU is
   port(
     input1,input2:in std_logic_vector(15 downto 0);  --兩個(gè)操作數(shù)
     choice:in std_logic_vector(5 downto 0);          --選擇進(jìn)行的運(yùn)算
     result:buffer std_logic_vector(15 downto 0);     --結(jié)果輸出
     result2:buffer std_logic_vector(15 downto 0);     --結(jié)果輸出
     psw   :buffer std_logic_vector(15 downto 0)      --PSW,psw(0)為C,psw(1)為Z,psw(2)為S,psw(3)為O
                                                           
      );
end ALU;

architecture alu_b of ALU is
signal q : std_logic_vector(16 downto 0);  --中間變量
signal result3:std_logic_vector(32 downto 0);     --中間變量
begin
  process(input1,input2,choice,q,psw)
  variable i : integer;
  variable p :std_logic_vector(15 downto 0);
  begin   
    if  choice="000001" then              --ADD
        q<=('0' & input1) + ('0' & input2);
        psw(0) <=q(16);
        psw(2) <=q(15);
        if q(15 downto 0)= "0000000000000000" then
            psw(1)<= '1';
        else
            psw(1)<= '0';
        end if;   
        result <= q(15 downto 0);
    elsif choice="000010"then                --ADDU
        result <= input1 + input2;
    elsif choice="000011" then                --SUB
        q<=('0'&input1) - ('0'& input2);   
        psw(0) <=q(16);
        psw(2) <=q(15);
        if q(15 downto 0)= "0000000000000000" then
            psw(1)<= '1';
        else
            psw(1)<= '0';
        end if;   
        result <= q(15 downto 0);
        
    elsif choice="000100" then                --SUBU
        result <= input1 - input2;
    --elsif choice="000101" then                --IMUL
    --    result3<= ('0'&input1) * ('0'& input2);
    --    psw(0) <=result3(32);
    --    psw(2) <=result3(31);
    --    if result3(31 downto 0)= "00000000000000000000000000000000" then
    --    psw(1)<= '1';
        --else
    --        psw(1)<= '0';
        --end if;   
    --    result<=result3(31 downto 16);
    --    result2<=result3(15 downto 0);
    --elsif choice="000110" then                --IDIV
    --    q<= ('0'&input1) mod ('0'& input2);
    --    psw(0) <=q(16);
    --    psw(2) <=q(15);
    --    if q(15 downto 0)= "0000000000000000" then
    --        psw(1)<= '1';
    --    else
    --        psw(1)<= '0';
    --    end if;   
    --    result <=q(15 downto 0);
    --    result2 <=input1 rem input2;
    elsif choice="000111" then                --INC
        q(15 downto 0)<= "0000000000000001" + input1;
        result <=q(15 downto 0);
    elsif choice="001000" then                --DEC
        q(15 downto 0)<= input1 - "0000000000000001" ;
        result <=q(15 downto 0);
    elsif choice="001001" then                --CMP
        q<=('0'&input1) - ('0'& input2);   
        psw(0) <=q(16);
        psw(2) <=q(15);
        if q(15 downto 0)= "0000000000000000" then
            psw(1)<= '1';
        else
            psw(1)<= '0';
        end if;   
    elsif choice="001010" then                --NEG
        q<="10000000000000000" - ('0'&input1);   
        psw(0) <=q(16);
        psw(2) <=q(15);
        if q(15 downto 0)= "0000000000000000" then
            psw(1)<= '1';
        else
            psw(1)<= '0';
        end if;   
        result <=q(15 downto 0);
    elsif choice="001011" then                --NOT
        result <= not input1;
    elsif choice="001100" then                --AND
        psw(0) <='0';
        psw(3) <='0';
        result <= input1 and input2;
        psw(2) <= result(15);
        if result(15 downto 0)= "0000000000000000" then
            psw(1)<= '1';
        else
            psw(1)<= '0';
        end if;   
    elsif choice="001101" then                --OR
        psw(0) <='0';
        psw(3) <='0';
        result <= input1 or input2;   
        psw(2) <= result(15);
        if result(15 downto 0)= "0000000000000000" then
            psw(1)<= '1';
        else
            psw(1)<= '0';
        end if;   
    elsif choice="001110" then                --XOR
        psw(0) <='0';
        psw(3) <='0';
        result <= input1 xor input2;   
        psw(2) <= result(15);
        if result(15 downto 0)= "0000000000000000" then
            psw(1)<= '1';
        else
            psw(1)<= '0';
        end if;   
    elsif choice="001111" then                --TEST
        psw(0) <='0';
        psw(3) <='0';
        q(15 downto 0) <= input1 xor input2;
        psw(2) <= q(15);
        if q(15 downto 0)= "0000000000000000" then
            psw(1)<= '1';
        else
            psw(1)<= '0';
        end if;   
    elsif choice="010000" then                --SHL
    --    function  f(bits,shift)
    --        for i in 1 to bits loop
     --         case shift is
     --           when shift="1001"
    --                 p:='0' & p(15 downto 1);
    --             when shift="1010"   
    --                 p:=p(15 downto 1) & '0' ;
    --             when shift ="1011" then
    --                 p:=p(14 downto 0)& p(15);
    --             when shift ="1100" then
    --                p:=p(0) & p(15 downto 1) ;
    --        end loop;
    --    end function

    end if;

全部資料51hei下載地址:
MIPS_16位CPU設(shè)計(jì).rar (11.97 MB, 下載次數(shù): 21)

評分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎勵(lì)!

查看全部評分

回復(fù)

使用道具 舉報(bào)

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表
主站蜘蛛池模板: 精品国产高清一区二区三区 | 国产精品毛片一区二区三区 | 美女逼网站 | 欧美精品一区二区三区四区 在线 | 中文字幕日韩一区二区 | 一级看片免费视频囗交动图 | 欧美亚洲视频 | 欧美一级网站 | 伊人免费网 | 国产免费福利小视频 | 精品一区二区三区四区在线 | 红色av社区| 999精品在线观看 | 免费小视频在线观看 | 成年人在线视频 | a在线免费观看 | 9porny九色视频自拍 | 精品国产成人 | 凹凸日日摸日日碰夜夜 | 精品一二三区在线观看 | 99久久亚洲| 欧美 日韩 综合 | 色在线视频网站 | 99亚洲精品 | 国产成人99av超碰超爽 | 久久国产精品视频 | 午夜精品久久久久久久星辰影院 | 粉嫩高清一区二区三区 | 欧美亚洲国产日韩 | 午夜精品一区二区三区三上悠亚 | 老熟女毛片 | 国产福利在线 | 中文字幕一区二区三区在线观看 | 日韩午夜一区二区三区 | 九九综合 | 亚洲欧美综合网 | 国产精品自拍视频 | 中文字幕精 | 99re在线播放| 亚洲国产一区二区三区在线观看 | 99精品国产一区二区青青牛奶 |