作业帮 > 综合 > 作业

ALU代表什么呀ALU是什么呀,它代表什么呀,

来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/05/03 06:48:33
ALU代表什么呀
ALU是什么呀,它代表什么呀,
ALU代表什么呀ALU是什么呀,它代表什么呀,
计算机中的ALU
ALU: (Arithmetic Logic Unit,算术逻辑单元)在处理器CPU之中用于计算的那一部分,与其同级的有数据传输单元和分支单元.ALU负责处理数据的运算工作,包括算术运算起(如:加、减、乘、除等),逻辑运算(如:AND、OR、NOT..等)及关系运算(比较大小等关系),并将运算的结果存回记忆单元.
下面举例8位ALU的两种设计方案.
使用原理图方法设计:
http://patrick.wagstrom.net/projects/academic/iiter/schematics/8alu.html
使用VHDL方法设计:
8-Bit ALU in VHDL
This arithmetic logic unit accepts 8-bit inputs, but it can easily be modded to higher bits. It supports the addition, subtraction, set if less than, AND, and OR operations. The operation to perform is determined by the 3-bit address bus.
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
ENTITY alu8bit IS
port(a, b : in std_logic_vector(7 downto 0); -- a and b are busses
op : in std_logic_vector(2 downto 0);
zero : out std_logic;
f : out std_logic_vector(7 downto 0));
END alu8bit;
architecture behavioral of alu8bit is
begin
process(op)
variable temp: std_logic_vector(7 downto 0);
begin
case op is
when "000" =>
temp := a and b;
when "100" =>
temp := a and b;
when "001" =>
temp := a or b;
when "101" =>
temp := a or b;
when "010" =>
temp := a + b;
when "110" =>
temp := a - b;
when "111" =>
if a < b then
temp := "11111111";
else
temp := "00000000";
end if;
when others =>
temp := a - b;
end case;
if temp="00000000" then
zero