当前位置:网站首页>Alu logic operation unit
Alu logic operation unit
2022-07-05 05:28:00 【Li Junfeng】
ALU Logical unit of operation
according to ( Two ) Medium to single cycle CPU The definition of , This module needs to realize the following 4 Class operation : Add 、 reduce 、 Bitwise AND 、 Press bit or . Therefore need 2 bit The control signal of Aluc To control ALU Operation type of .
Correspondence of signals :
surface 4 1 Aluc Coding and corresponding functions
Aluc code Realization function Arithmetic type
00 Add Arithmetic operation
01 reduce Arithmetic operations
10 Bitwise AND Logical operations
11 Press bit or Logical operations
Addition and subtraction can be used 32 Bit full adder ADDSUB_32 Realization , Bitwise and used AND32, Bit by bit or used OR32, The choice of function uses 32 Bit two choose one multi-channel selector MUX2X32 Realization , Returned the result R, as well as ALU Whether the operation result of is 0 The judgment of the Z( if R=0,Z=1;),Z Mainly for beq、bne Instructions .
Code
module ALU(X,Y,Aluc,R,Z);
input [31:0]X,Y;
input [1:0] Aluc;
output [31:0]R;
output Z;
wire [31:0]d_as,d_and,d_or,d_and_or;
ADDSUB_32 as32(X,Y,Aluc[0],d_as);
AND32 a32(X,Y,d_and);
OR32 o32(X,Y,d_or);
MUX2X32 select1(d_and,d_or,Aluc[0],d_and_or);
MUX2X32 select2(d_as,d_and_or,Aluc[1],R);
isZero i1(R,Z);
endmodule
边栏推荐
- 剑指 Offer 58 - II. 左旋转字符串
- 记录QT内存泄漏的一种问题和解决方案
- [to be continued] I believe that everyone has the right to choose their own way of life - written in front of the art column
- Using HashMap to realize simple cache
- Yolov5 ajouter un mécanisme d'attention
- Haut OJ 1218: maximum continuous sub segment sum
- 挂起等待锁 vs 自旋锁(两者的使用场合)
- PMP考试敏捷占比有多少?解疑
- Double pointer Foundation
- Little known skills of Task Manager
猜你喜欢
随机推荐
挂起等待锁 vs 自旋锁(两者的使用场合)
Merge sort
Pointnet++的改进
Time complexity and space complexity
Corridor and bridge distribution (csp-s-2021-t1) popular problem solution
[binary search] 34 Find the first and last positions of elements in a sorted array
Count sort
sync. Interpretation of mutex source code
Zzulioj 1673: b: clever characters???
Find a good teaching video for Solon framework test (Solon, lightweight application development framework)
Drawing dynamic 3D circle with pure C language
[allocation problem] 455 Distribute cookies
Solon Logging 插件的添加器级别控制和日志器的级别控制
TF-A中的工具介绍
Improvement of pointnet++
[to be continued] [UE4 notes] L3 import resources and project migration
Programmers' experience of delivering takeout
To be continued] [UE4 notes] L4 object editing
Quick sort summary
What is the agile proportion of PMP Exam? Dispel doubts