亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? coreofcpu.vhd

?? 幾個VHDL的源代碼和和一個本人編寫的5級流水線RISC CPU的代碼
?? VHD
字號:
--core_design
--cpu
--all right reserved

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use IEEE.std_logic_arith.all;

entity cpu is
  generic(delay:time:=3 ns);
  port(clk:in std_logic;
       reset:in std_logic;--high
       over_flow:out std_logic;
       data_ex:in std_logic_vector(31 downto 0)
      );
end cpu;

architecture core of cpu is

subtype ram_range is integer range 0 to 31;
subtype ram_lenth is std_logic_vector(31 downto 0);
type ram is array (ram_range) of ram_lenth;
signal ram_array:ram;

function logic2int(din:std_logic_vector(4 downto 0)) return ram_range is
    variable result:ram_range:=0;
  begin
    for i in 0 to 4 loop 
      if din(i)='1' then
        result:=result+2**i;
      end if;
    end loop;
    return result;
end logic2int;

------------------
--IF/ID stage
------------------
        type ifid_struct is record
		iword     : std_logic_vector(31 downto 0);  --instruction word
		pc        : std_logic_vector(31 downto 0);  --pc for this instruction
		
		cm_hw_int : std_logic;                      --hw interupt
	end record;
	signal ifid_in:ifid_struct;
	signal ifid_out:ifid_struct;

------------------
--ID/EX stage
------------------
        type idex_struct is record
                read_data1:std_logic_vector(31 downto 0);
                read_data2:std_logic_vector(31 downto 0);
                after_sign:std_logic_vector(31 downto 0);
        	       wb:std_logic_vector(1 downto 0);
        		m:std_logic_vector(1 downto 0);  					  --read & write
 		ex:std_logic_vector(9 downto 0);          --ALUsrcB & ALUsrcA & inv_in2 & ALUop
        		ins1:std_logic_vector(4 downto 0);
        		ins2:std_logic_vector(4 downto 0);
        end record;
        signal idex_in:idex_struct;
        signal idex_out:idex_struct;
 	
------------------
--EX/MEM stage
------------------
	type exmem_structure is record
	        ALU_result:std_logic_vector(31 downto 0);
		data:std_logic_vector(31 downto 0);
		wb:std_logic_vector(1 downto 0);
        		m:std_logic_vector(1 downto 0);
        		ins:std_logic_vector(4 downto 0);
	end record;
	signal exmem_in:exmem_structure;
	signal exmem_out:exmem_structure;
	
------------------
--MEM/WB stage
------------------
	type memwb_struct is record
	        ALU_result:std_logic_vector(31 downto 0);
	        memdata:std_logic_vector(31 downto 0);
	        wb:std_logic_vector(1 downto 0);
	        ins:std_logic_vector(4 downto 0);
	end record;
	signal memwb_in:memwb_struct;
	signal memwb_out:memwb_struct;
	
component ALU
  port(op: in std_logic_vector(2 downto 0);        -- ALU operation
       inv_in2 : in std_logic;                     -- Invert operator in2
       in1, in2: in std_logic_vector(31 downto 0); -- ALU input
       ovf: out std_logic;                         -- ALU overflow
       alu_out: out std_logic_vector(31 downto 0)
      );
end component;
signal read1:std_logic_vector(31 downto 0);
signal read2:std_logic_vector(31 downto 0);
signal ovf_sig:std_logic;

component control
  port (reset:in std_logic;
  	op : in std_logic_vector (5 downto 0);         	-- The op code
	memread:out std_logic;
	memwrite:out std_logic;
	memtoreg:out std_logic;
	pcsource:out std_logic;
	ALUop:out std_logic_vector(2 downto 0);
	ALUsrcB:out std_logic_vector(1 downto 0);
	ALUsrcA:out std_logic_vector(1 downto 0);
	ALUsrc:out std_logic;
	inv_in2:out std_logic;
	regdst:out std_logic;
	regwrite:out std_logic
       );
  end component;

component ins_rom
  port(clk:in std_logic;
       a:in std_logic_vector(31 downto 0);
        readdata:out std_logic_vector(31 downto 0)
       );
end component;

component dram
  port (clk:in std_logic;
	addr:in std_logic_vector(31 downto 0);
        data_in:in std_logic_vector(31 downto 0);
        data_out:out std_logic_vector(31 downto 0);
	ras:in std_logic;
	we:in std_logic
       );
end component;

component mux2_1
  port (en:in std_logic;
  	in1:in std_logic_vector(31 downto 0);
  	in2:in std_logic_vector(31 downto 0);
  	out1:out std_logic_vector(31 downto 0)
       );
end component;

component mux4_1
  port (en:in std_logic_vector(1 downto 0);
  	in1:in std_logic_vector(31 downto 0);
  	in2:in std_logic_vector(31 downto 0);
  	in3:in std_logic_vector(31 downto 0);
  	in4:in std_logic_vector(31 downto 0);
  	out1:out std_logic_vector(31 downto 0)
       );
end component;

component opt
  port (reset:in std_logic;
  	in1:in std_logic_vector(15 downto 0);
  	in2:in std_Logic_vector(31 downto 0);
  	out1:out std_Logic_vector(31 downto 0);
  	out2:out std_Logic_vector(31 downto 0)
       );
end component;

-------------------
--some signal
-------------------
signal PC_reg:std_logic:='0';  --tell PC instruction rom to read
signal PC_source:std_logic;
signal PC_in:std_logic_vector(31 downto 0);
signal PC_out:std_logic_vector(31 downto 0);
signal PC_out1:std_logic_vector(31 downto 0);
signal after_opt:std_logic_vector(31 downto 0);
signal reg_write:std_logic_vector(4 downto 0);
signal reg_data:std_logic_vector(31 downto 0);
signal memtoreg_out:std_logic_vector(31 downto 0);
signal nodata:std_logic_vector(31 downto 0);
signal read21:std_logic_vector(31 downto 0);
signal eaquel:std_logic;
signal jump:std_logic_vector(31 downto 0);
signal PC_en:std_logic_vector(1 downto 0);

begin
ifid_in.iword<=pc_out1;
over_flow<=ovf_sig;
PC_en<=eaquel & PC_source; 
exmem_in.data<=read21;
reg_data<=memtoreg_out;
memwb_in.ALU_result<=exmem_out.ALU_result;
reg_write<=MEMwb_out.ins;
memwb_in.ins<=exmem_out.ins;

U1:ins_rom port map (clk,PC_out,ifid_in.pc(31 downto 0));
U2:ALU port map (idex_out.ex(2 downto 0),idex_out.ex(3),read1,read2,ovf_sig,exmem_in.ALU_result);
U3:control port map (reset,ifid_out.pc(31 downto 26),idex_in.m(1),idex_in.m(0),idex_in.wb(0),
		     PC_source,idex_in.ex(2 downto 0),idex_in.ex(8 downto 7),idex_in.ex(6 downto 5),
		     idex_in.ex(4),idex_in.ex(3),idex_in.ex(9),idex_in.wb(1));
U4:mux4_1 port map (PC_en,after_opt,PC_out1,exmem_out.ALU_result,jump,PC_in);
U5:opt port map (reset,ifid_out.pc(15 downto 0),ifid_out.iword,idex_in.after_sign,after_opt);
U7:mux4_1 port map (idex_out.ex(8 downto 7),idex_out.read_data1,memtoreg_out,exmem_out.ALU_result,
			nodata,read1);
U8:mux4_1 port map (idex_out.ex(6 downto 5),idex_out.read_data2,memtoreg_out,exmem_out.ALU_result,
			nodata,read21);
U9:mux2_1 port map (idex_out.ex(4),read21,idex_out.after_sign,read2);
U10:dram port map (clk,exmem_out.ALU_result,exmem_out.data,memwb_in.memdata,exmem_out.m(1),exmem_out.m(0));
U11:mux2_1 port map (memwb_out.wb(0),memwb_out.memdata,memwb_out.ALU_result,memtoreg_out);

PC_updata:process(clk)  --PC update every rising clock
	   begin
	    if clk'event and clk='1' then 
	     if reset='1' then
		  PC_out<=(others=>'0');
		 elsif reset='0' then
	       PC_out<=PC_in;
	     end if;
	    end if;
	  end process;

self_increase:process(PC_out,clk)--you ifid_in chufa jincheng
 		begin 
 		 pc_out1<=pc_out + "100";
 	      end process self_increase;

ifid_stage:process(clk)
   	    begin
   	      if clk'event and clk='1' then
   	        if reset='1' then
   	          ifid_out<=((others=>'0'),(others=>'0'),'0');
   	        else 
   	        ifid_out<=ifid_in;
   	        end if;
		  end if;
   	    end process ifid_stage;
   	   
idex_in.read_data1<=(others=>'0') when ifid_out.pc(25 downto 21) = "00000" else
            		    (others=>'0') when ifid_out.pc(31 downto 26) = "101101" else
		    reg_data when ifid_in.pc(25 downto 21) = reg_write else
		    ram_array(conv_integer(ifid_out.pc(25 downto 21)));
idex_in.read_data2<=data_ex when (ifid_out.pc(20 downto 16) = "00000" and ifid_out.pc(31 downto 26) = "101100") else 
		    reg_data when ifid_in.pc(20 downto 16) = reg_write else
		    ram_array(conv_integer(ifid_out.pc(20 downto 16)));
		    
process(clk)
begin
if clk'event and clk='1' then
 if memwb_out.wb(1)='1' then
  if reg_write/="00000" then 
   ram_array(conv_integer(reg_write))<=reg_data;
  elsif reg_write="00000" then
   ram_array(0)<=reg_data;
  end if;
 end if;
end if;
end process;

branch:eaquel<='0' when idex_in.read_data1=idex_in.read_data2 else
                '0' when idex_in.read_data1=idex_in.read_data2 and idex_in.read_data1="UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU" and  idex_in.read_data2="UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU" else  
	        '0';
      
idex_stage:process(clk)
	    begin 
	     if clk'event and clk='1' then
	       if reset='1' then
	         idex_out<=((others=>'0'),(others=>'0'),(others=>'0'),(others=>'0'),
	                   (others=>'0'),(others=>'0'),(others=>'0'),(others=>'0'));
	       else 
	         idex_out<=idex_in;
	       end if;
	     end if;
 	    end process idex_stage;
 	    
exmem_stage:process(clk)
  	     begin
  	      if clk'event and clk='1' then
	       if reset='1' then
	         exmem_out<=((others=>'0'),(others=>'0'),(others=>'0'),(others=>'0'),(others=>'0'));
	       else 
	         exmem_out<=exmem_in;
	       end if;
	      end if;
	    end process exmem_stage;

memwb_stage:process(clk)
  	     begin 
  	      if clk'event and clk='1' then
	       if reset='1' then
	         memwb_out<=((others=>'0'),(others=>'0'),(others=>'0'),(others=>'0'));
	       else 
	         memwb_out<=memwb_in;
	       end if;
	      end if;
	    end process memwb_stage;

data_buffer:process(clk)
	     begin
	      if clk'event and clk='0' then
	       exmem_in.wb<=idex_out.wb after 1 ns;
	       exmem_in.m<=idex_out.m after 1 ns;
	       memwb_in.wb<=exmem_out.wb after 1 ns;
	       idex_in.ins1<=ifid_out.pc(20 downto 16) after 1 ns;
	       idex_in.ins2<=ifid_out.pc(15 downto 11) after 1 ns;
	      end if;
	      end process;
	      
mux:process(idex_out.ex(9),idex_out.ins1,idex_out.ins2)
	begin
	 if reset='0' then
	   case idex_out.ex(9) is
	    when '0' => exmem_in.ins<=idex_out.ins1;
	    when '1' => exmem_in.ins<=idex_out.ins2;
	    when others=>null;
	   end case;
	 else
	   exmem_in.ins<=(others=>'Z');
	 end if;
	end process;
end core;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲午夜久久久久中文字幕久| 国产美女娇喘av呻吟久久| 三级欧美韩日大片在线看| 国产乱一区二区| 欧美男生操女生| 亚洲特级片在线| 国内精品不卡在线| 欧美男人的天堂一二区| 中文字幕亚洲欧美在线不卡| 久久精品国产网站| 欧美肥胖老妇做爰| 亚洲黄色av一区| 成人激情免费电影网址| 久久精品视频一区二区| 蜜桃视频在线一区| 欧美美女黄视频| 亚洲午夜免费视频| 欧美在线色视频| 亚洲男帅同性gay1069| www..com久久爱| 国产精品污网站| 丁香啪啪综合成人亚洲小说 | 91黄色免费观看| 中文字幕精品一区二区三区精品 | 国产91丝袜在线观看| 日韩免费看网站| 蜜桃视频在线一区| 欧美一区二区精品| 日韩高清一级片| 日韩一区二区免费在线观看| 天天综合天天做天天综合| 欧美揉bbbbb揉bbbbb| 一区二区三区蜜桃网| 91成人免费网站| 亚洲超丰满肉感bbw| 欧美日韩在线播| 日韩高清不卡在线| 欧美一级二级三级乱码| 美女性感视频久久| 精品盗摄一区二区三区| 狠狠网亚洲精品| 欧美高清在线精品一区| 91在线观看美女| 亚洲成av人片观看| 日韩欧美高清在线| 国产不卡高清在线观看视频| 中文字幕在线观看不卡| 91麻豆swag| 青青草97国产精品免费观看无弹窗版| 日韩视频在线你懂得| 国产一区二区三区国产| 中文字幕在线观看一区| 欧美日韩一级片网站| 美女视频黄免费的久久| 国产日韩欧美精品电影三级在线| 国产超碰在线一区| 一区二区成人在线| 欧美一区二区三区在线观看视频| 久久99精品国产麻豆婷婷洗澡| 亚洲精品在线三区| www.日韩精品| 三级一区在线视频先锋| 久久久不卡网国产精品一区| 色婷婷久久久综合中文字幕| 五月天激情小说综合| 久久久一区二区三区| 色婷婷久久综合| 精品一二三四在线| 亚洲丝袜自拍清纯另类| 精品人伦一区二区色婷婷| 色婷婷av一区二区三区之一色屋| 日本sm残虐另类| 成人欧美一区二区三区白人 | 欧亚一区二区三区| 老色鬼精品视频在线观看播放| 国产欧美一区二区精品性色 | 日韩国产欧美视频| 欧美国产禁国产网站cc| 4438成人网| 成人午夜在线免费| 日本va欧美va瓶| 亚洲裸体xxx| 久久嫩草精品久久久精品一| 欧美视频中文字幕| 国产**成人网毛片九色| 美女一区二区在线观看| 亚洲另类春色国产| 亚洲国产精品成人综合| 欧美成人在线直播| 欧美精品一卡两卡| av爱爱亚洲一区| 国产激情一区二区三区四区 | 日韩一区二区三免费高清| 91啦中文在线观看| 国产宾馆实践打屁股91| 六月丁香综合在线视频| 亚洲成年人影院| 亚洲精品成人悠悠色影视| 国产欧美一区二区三区网站 | 欧美日韩免费在线视频| jizz一区二区| 成人精品一区二区三区中文字幕| 久久国产福利国产秒拍| 五月天网站亚洲| 一区二区三区精密机械公司| 国产精品久久久久精k8| 国产欧美精品一区二区色综合| 精品美女在线播放| 欧美精品vⅰdeose4hd| 欧洲一区二区三区免费视频| 91麻豆精品在线观看| 91丨九色丨尤物| 99久久国产综合精品麻豆| caoporn国产一区二区| 99久久婷婷国产综合精品电影 | 国产精品系列在线| 中文字幕av一区 二区| 日韩欧美成人午夜| 日韩西西人体444www| 欧美成人国产一区二区| 欧美mv日韩mv| 久久精品视频网| 欧美高清在线精品一区| 日韩一区欧美一区| 一区二区三区高清在线| 亚洲国产一区视频| 日韩高清不卡一区二区| 久久精品久久久精品美女| 国产一区激情在线| 成人免费不卡视频| 色综合一个色综合| 欧美人牲a欧美精品| 欧美成人vps| 欧美韩国一区二区| 亚洲精品欧美综合四区| 日韩精品一级中文字幕精品视频免费观看 | 亚洲精品久久久蜜桃| 亚洲r级在线视频| 久久91精品国产91久久小草| 成人18视频日本| 欧美日韩视频一区二区| 久久综合九色综合欧美就去吻| 国产日韩欧美制服另类| 日韩伦理av电影| 三级亚洲高清视频| 国产成人自拍网| 欧美三片在线视频观看| 精品免费视频一区二区| 亚洲免费av高清| 蜜臀av性久久久久蜜臀aⅴ流畅| 成人免费毛片嘿嘿连载视频| 91成人在线精品| 精品粉嫩aⅴ一区二区三区四区| 综合精品久久久| 久久国产麻豆精品| 不卡av免费在线观看| 日韩视频一区二区三区在线播放 | 欧美不卡123| 亚洲理论在线观看| 精品亚洲免费视频| 91小视频免费观看| 26uuu亚洲| 亚洲成a人v欧美综合天堂| 国产99久久久精品| 欧美二区在线观看| 亚洲色图在线看| 国产最新精品免费| 欧美日韩精品三区| 自拍偷在线精品自拍偷无码专区| 老司机一区二区| 欧美日韩一区在线观看| 国产精品剧情在线亚洲| 精品亚洲欧美一区| 4438x成人网最大色成网站| 亚洲欧美日韩中文字幕一区二区三区 | 欧美精品久久99| 国产精品国产a级| 激情偷乱视频一区二区三区| 4hu四虎永久在线影院成人| 亚洲免费毛片网站| 成人黄色在线视频| 久久综合久久99| 久久99久久久久久久久久久| 91成人国产精品| 亚洲精品免费一二三区| 国产盗摄女厕一区二区三区| 日韩欧美黄色影院| 天堂av在线一区| 欧美精品视频www在线观看| 亚洲女同ⅹxx女同tv| 99久久综合色| 国产精品久久久久久久第一福利| 国产成人综合亚洲网站| 久久久久国色av免费看影院| 午夜成人免费视频| 欧美久久久一区| 日韩—二三区免费观看av| 欧美电影影音先锋| 奇米888四色在线精品| 日韩一区二区三区免费观看|