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

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 3735|回復: 0
收起左側

基于quartus 2 9.0c 軟件的MIPS指令集16位CPU設計

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

總體狀態轉換圖
0.jpg

畫出QuartusⅡ環境下的數據通路總圖

51hei.png

七、編寫匯編語言,調試程序,給出結果

為了方便輸入與編碼,指令格式自己譯成 操作碼/尋址方式/目的寄存器/源寄存器
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);  --兩個操作數
     choice:in std_logic_vector(5 downto 0);          --選擇進行的運算
     result:buffer std_logic_vector(15 downto 0);     --結果輸出
     result2:buffer std_logic_vector(15 downto 0);     --結果輸出
     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設計.rar (11.97 MB, 下載次數: 21)

評分

參與人數 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎勵!

查看全部評分

回復

使用道具 舉報

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

本版積分規則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 91免费福利在线 | 日本在线观看视频 | 欧美在线一区二区三区四区 | 一区二区三区国产精品 | 日日干日日操 | 99久久日韩精品免费热麻豆美女 | 久久精品视频91 | 黄网站免费在线观看 | www.伊人.com | 日韩欧美在线免费 | 中国一级毛片免费 | 综合二区 | 青青青伊人 | 亚洲一区二区三区在线观看免费 | 日本不卡一区 | 色吧久久| 亚洲一区免费在线 | 久久久久久久久久久91 | 中文字幕成人av | 欧美日韩高清在线一区 | 国产成人精品午夜 | 久久久久国产精品一区二区 | 欧美一区二区三区在线播放 | 在线国产一区 | 国产真实乱全部视频 | 狠狠操狠狠干 | 激情五月婷婷在线 | 91电影院 | 最新av中文字幕 | 精品一区二区三区四区外站 | 久久精品aaa | 国产精品久久九九 | 中文字幕乱码视频32 | 国产日产久久高清欧美一区 | 亚洲精品一区二区三区蜜桃久 | 性色视频 | 国产黄色大片网站 | 日本亚洲欧美 | 天天天操操操 | 精品一区二区观看 | 久久99精品国产 |