【正文】
。根據(jù)相加的格式做相應(yīng)位置的調(diào)整,并且對(duì)相應(yīng)的信號(hào)根據(jù)使用的功能不同進(jìn)行賦值 b_in=not a when alu_func=001 else a。cin。 end ponent。 s : out std_logic_vector(7 downto 0)。 輸出結(jié)果 ,過程變量 signal temp1 : std_logic_vector(7 downto 0)。 操作數(shù) b ,過程變量 signal c_in_3 : std_logic。 輸出結(jié)果,過程變量 signal a_in_3 : std_logic_vector(7 downto 0)。 操作數(shù) b ,過程變量 signal c_in_2 : std_logic。 輸出結(jié)果,過程變量signal a_in_2 : std_logic_vector(7 downto 0)。 操作數(shù) b ,過程變量 signal c_in_1 : std_logic。 輸出結(jié)果 ,過程變量 signal a_in_1:std_logic_vector(7 downto 0)。 操作數(shù) b , 過程變量 signal c_in : std_logic。說明:信號(hào)的定義必須在進(jìn)程之外說明signal a_in : std_logic_vector(7 downto 0)。end alu。 alu_out:out std_logic_vector(7 downto 0)。 a,b:in std_logic_vector(7 downto 0)。alu_a,alu_b:in std_logic_vector(15 downto 0)。use 。use 。end structure。 end generate f1_7。 定義信號(hào),結(jié)果過程變量s_temp, 進(jìn)位C begin f0: fa port map( a(0),b(0),ci,s_temp(0),c(0) )。end ponent。定義實(shí)體architecture structure of adder8bit is 結(jié)構(gòu)體定義,里面可以對(duì)signal名、ponent、常量進(jìn)行定義ponent fa port(a,b,ci : in std_logic。 ci : in std_logic)。entity adder8bit is port( a,b : in std_logic_vector(7 downto 0)。use 。一位加法過程end b_fa。architecture b_fa of fa isbegin s=a xor b xor ci。 s,co : out std_logic)。use 。ALU:組合邏輯部件,對(duì)兩個(gè)16位的輸入及進(jìn)位輸入Cin可進(jìn)行由3位控制信號(hào)控制的如下操作:I2I1I0功能000A+B+Cin001ABCin010A與B011A或B100A異或B101B 左移110B右移:一位fa8位加法器 Alu改造后的VHDL語(yǔ)言的行為描述如下,:說明:用綠色表明的文字表示是相應(yīng)的注釋,用綠色表明的代碼為原先的部分代碼(即是要修改或是要取代的代碼),用藍(lán)色表面的代碼為修改的或是自行增加的代碼,用加粗部分的文字為參考原來參考材料報(bào)告的部分內(nèi)容??梢圆糠謪⒄諈⒖疾牧系奈臋n寫法。、vhd文件內(nèi)容,以及相關(guān)電原理圖截圖、用于說明的表格、用于說明的示意圖等。另外還要將16位數(shù)據(jù)選擇器BUS_MUX也改成8位通路,以及將組合邏輯器件器件T1也改成8位通路,并且參加了小組的整個(gè)程序相關(guān)部分的調(diào)式。將cpu中的16位alu器件改為8位alu器件。(2)修改后是否可運(yùn)行(指加到整個(gè)小組的系統(tǒng)里)答:可以運(yùn)行。(1)修改后是否編譯通過(指加到整個(gè)小組的系統(tǒng)里)答:是。 Timer截圖3. 執(zhí)行(ALU相關(guān))(0)是否加到最后整組的系統(tǒng)中如果回答為否,可跳過第(1)和(2)問。 end process。 when s5= output=111。 when s3= output=011。 when s1= output=000。 end process。 end case。 when s4= state=s5。 end if。) then 根據(jù)頭兩位是11選擇B組指令 state=s4。 and ins(6) = 39。 when s2= if (ins(7) = 39。) then case state is when s0= state=s1。event and clk=39。 then state=s0。begin process(clk,reset,ins) begin if reset=39。architecture behave of timer is type state_type is(s0,s1,s2,s3,s4,s5)。 output : out std_logic_vector(2 downto 0))。 reset : in std_logic。use 。end behave。 en_pc=alu_out_sel(1)。 end case。 end case。039。 alu_in_sel=001。139。 alu_in_sel=101。139。 alu_in_sel=101。 rec=00。 sst=11。 offset=0000。 when 111= 讀寫內(nèi)存 dest_reg=temp3。 when others= null。 alu_in_sel=010。 when 1111= sci=00。 alu_in_sel=001。 when 1110= 目的地址送地址寄存器 LDRR sci=00。 alu_in_sel=100。 case temp1 is when 1100 | 1101= 讀取雙字指令的后一半(JMPA MVRD) sci=01。 sour_reg=temp4。 sst=11。 wr=39。 end case。 alu_func=000。0。 sst=11。 offset=temp2。 when 1011= JRNC dest_reg=00。 alu_in_sel=011。 alu_out_sel:=camp。 sci=00。 sour_reg=00。 alu_func=000。 alu_out_sel:=10。 sci=00。 sour_reg=00。 alu_func=000。 alu_out_sel:=01。 sci=10。 sour_reg=temp4。 alu_func=001。 alu_out_sel:=00。 sci=00。 sour_reg=temp4。 alu_func=001。 alu_out_sel:=01。 sci=01。 sour_reg=temp4。 alu_func=000。 alu_out_sel:=01。 sci=01。 sour_reg=temp4。 alu_func=011。 alu_out_sel:=01。 sci=00。 sour_reg=temp4。 alu_func=100。 alu_out_sel:=01。 sci=00。 sour_reg=temp4。 alu_func=010。 alu_out_sel:=01。 sci=00。 sour_reg=temp4。 alu_func=001。 alu_out_sel:=01。 sci=00。 sour_reg=temp4。 alu_func=000。 alu_out_sel:=01。 sci=00。 sour_reg=temp4。 rec=00。 when 011= A組指令 wr=39。139。 alu_func=000。 alu_out_sel:=00。 sci=00。 sour_reg=00。 rec=01。 wr=39。 alu_in_sel=100。 sst=11。 offset=0000。 when 000= 讀取指令第一拍 dest_reg=00。139。 alu_func=000。 alu_out_sel:=00。 sci=00。 sour_reg=00。 暫存低4位中的低2位 end loop。 for I in 1 downto 0 loop temp3(I):=instruction(I+2)。 暫存指令高4位 temp2(I):=instruction(I)。 variable alu_out_sel: std_logic_vector(1 downto 0)。architecture behave of controller isbegin process(timer,instruction,c,z,v,s) variable temp1,temp2 : std_logic_vector(3 downto 0) 。 en_reg,en_pc,wr: out std_logic)。 偏移地址 sst,sci,rec: out std_logic_vector(1 downto 0)。 標(biāo)志位 dest_reg,sour_reg: out std_logic_vector(1 downto 0)。 節(jié)拍 instruction: in std_logic_vector(7 downto 0)。use 。特別注意:如果沒被抽中去演示,則主要根據(jù)分工所對(duì)應(yīng)的這部分設(shè)計(jì)的撰寫的內(nèi)容評(píng)分,因此要盡量詳細(xì)地介紹你的工作。(加注釋,特別是在參考材料的源代碼基礎(chǔ)上改動(dòng)之處,用藍(lán)色標(biāo)出)。(4)相關(guān)的源代碼、電原理圖和其它說明表格。2. 控制邏輯(0)是否加到最后整組的系統(tǒng)中 如果回答為否,可跳過第(1)和(2)問。可以部分參照參考材料的文檔寫法。、vhd文件內(nèi)容,以及相關(guān)電原理圖截圖、用于說明的表格、用于說明的示意圖等。點(diǎn)擊Debug菜單中的End Debug或者工具欄上的,結(jié)束Debug模式。11) 結(jié)束調(diào)試。10) 特別之處,設(shè)置斷點(diǎn)是在Debug Window相應(yīng)的行上鼠標(biāo)雙擊,取消斷點(diǎn)也是相應(yīng)的鼠標(biāo)雙擊。8) 點(diǎn)擊Debug菜單中的Begin Debug,或者點(diǎn)擊工具欄中的開始調(diào)試。7) 在使用Quartus軟件將CPU設(shè)計(jì)經(jīng)編譯、連接和適配后,將它下載到FPGA中,在FPGA中生成一個(gè)物理CPU。6) 點(diǎn)擊Build菜單中的Upload BIN或者點(diǎn)擊工具欄中的,將16進(jìn)制代碼文件上傳到存儲(chǔ)器(RAM)中。4) 點(diǎn)擊Build菜單中的Compile Code或者點(diǎn)擊工具欄中的,將偽匯編文件編譯為16進(jìn)制文件。程序會(huì)向COM1~COM4順序發(fā)送一個(gè)測(cè)試命令,等待