SlideShare una empresa de Scribd logo
1 de 21
8 Bit ALU
Presented By :
Chirag Vaidya (16MECV27)
Yash Nagaria (16MECV15)
12/29/2016 18 Bit ALU
Guided By :
Dr. N. P. Gajjar
Contents :
 ALU Introduction
 Block Diagram
 Flowchart
 Verilog Code
 Test bench
 Simulation
 Synthesis report
 Device Utilization Summary
 Final Report
 Power and Thermal analysis
 Future scope
12/29/2016 28 Bit ALU
ALU Introduction :
 An arithmetic logic unit is a digital circuit used to perform arithmetic and logic
operations.
 The following operations can be performed in ALU :
 Addition
 Subtraction
 Bitwise AND
 Bitwise OR
 Bitwise NOT
 Bitwise XOR
 Shift Left, Shift Right
 Rotate Left with Carry, Rotate Right Carry
 Checking the status of these flags C, AC, Z, S, P
12/29/2016 38 Bit ALU
Block Diagram of ALU :
A
B
Operation
Selection
CMP--++
RLRRSLSR
AND OR NOT EX-
OR
Out
C
Z
S
AC
Arithmetic and Logical operationregister
out
12/29/2016 48 Bit ALU
Flow chart : Start
Enter Data
A , B
S!=0
to 10
Output
Display (invalid sel)
Sel = 0 to 10
yes
no
12/29/2016 58 Bit ALU
Verilog Code :
module alu8_bit(out , sel , C , AC , PE , S , Z);
//input [7:0] A,B;
input [3:0]sel;
output reg [7:0] out ;
output reg C,AC,S,Z;
output PE;
reg [7:0] A = 8'b11000001;
reg [7:0] B = 8'b00101001;
always @(sel , A , B)
begin
case(sel)
0: out = A & B; // BITWISE AND
1: out = A | B; // BITWISE OR
2: out = ~A; // BITWISE NOT
3: out = A^B; // EX-OR
4: out = A>>1; // SHIFT RIGHT
5: out = A<<1; // SHIFT LEFT
12/29/2016 68 Bit ALU
6: begin
C = A[0];
out = {C,A[7:1]}; // ROTATE RIGHT
end
7: begin
C = A[7];
out = {A[6:0],C}; // ROTATE LEFT
end
8: begin
{AC,out[3:0]} = A[3:0] + B[3:0] ; // Lower nibble addition with Auxillary Carry
{C,out[7:4]} = A[7:4] + B[7:4] + AC; // Upper nibble addition with Carry
S = out[7]; // Sign flag
end
9: begin
{AC,out[3:0]} = A[3:0] - B[3:0] ; // Lower nibble Subtraction with Auxillary Carry
{C,out[7:4]} = A[7:4] - B[7:4] ; // Upper nibble Subtraction with Carry
S = out[7]; // Sign flag
end
12/29/2016 78 Bit ALU
// For CMP instructuion
10: begin
{C,out[7:0]} = A[7:0] - B[7:0] ; // Upper nibble Subtraction with Carry
{AC,out[3:0]} = A[3:0] - B[3:0] ;
S = out[7]; // Sign flag
if(out== 8'b0000_0000)
begin
Z <=1'b1;
$display("A is equal to B");
end
else if (C==0)
begin
$display("A is greater than B");
end
else if (C==1)
begin
$display("A is less than B");
end
end
default : $display("PLease enter valid selection");
endcase
12/29/2016 88 Bit ALU
if (out == 8'b0000_0000)
begin
Z <= 1'b1;
end
else
begin
Z <= 1'b0;
end
end
even_parity m0(PE,A);
endmodule
module even_parity(out , in);
input [7:0]in;
output out;
assign out=(in[0]^in[1]^in[2]^in[3]^in[4]^in[5]^in[6]^in[7]);
endmodule 12/29/2016 98 Bit ALU
Test bench :
module alu;
// Inputs
reg [3:0] sel;
reg [7:0] A;
reg [7:0] B;
// Outputs
wire [7:0] out;
wire C;
wire AC;
wire PE;
wire S;
wire Z;
// Instantiate the Unit Under Test (UUT)
alu8_bit uut (
.out(out),
.sel(sel),
.C(C),
.AC(AC),
.PE(PE),
.S(S),
.Z(Z),
.A(A),
.B(B)
);
12/29/2016 108 Bit ALU
initial begin
// Initialize Inputs
sel = 0000;
A = 8'b11001001;
B = 8'b10001001;
#1000 sel = 0;
#1000 sel = 1;
#1000 sel = 2;
#1000 sel = 3;
#1000 sel = 4;
#1000 sel = 5;
#1000 sel = 6;
#1000 sel = 7;
#1000 sel = 8;
#1000 sel = 9;
#1000 sel = 10;
#1000;
// Add stimulus here
end
endmodule 12/29/2016 118 Bit ALU
Simulation :
12/29/2016 128 Bit ALU
Synthesis report :
HDL Synthesis Report
Macro Statistics
# Adders/Subtractors : 5
4-bit adder carry in/out : 1
4-bit adder carry out : 1
5-bit subtractor : 2
9-bit subtractor : 1
# Latches : 11
1-bit latch : 11
# Multiplexers : 8
1-bit 11-to-1 multiplexer : 8
# Xors : 9
1-bit xor2 : 8
1-bit xor8 : 1
12/29/2016 138 Bit ALU
Device Utilization Summary :
12/29/2016 148 Bit ALU
Final report :
Cell Usage :
# GND : 1
# LUT2 : 15
# LUT3 : 21
# LUT4 : 63
# VCC : 1
# XORCY : 9
# Flip-flops/Latches : 19
# IO Buffers : 33
# IBUF : 20
# OBUF : 13
RTL Top Level Output File Name : alu8_bit.ngr
Top Level Output File Name : alu8_bit
Output Format : NGC
Optimization Goal : Speed
Keep Hierarchy : No
Design Statistics
IOs : 33
12/29/2016 158 Bit ALU
Power and Thermal Analysis :
12/29/20168 Bit ALU 16
Future Scope :
 We have designed 8 bit ALU , which can be used in many 8 bit µprocessor or
µcontroller , also in SoC .
 We can do parallel processing operations using pipelining concept .
12/29/2016 178 Bit ALU
References :
 https://en.wikipedia.org/wiki/Arithmetic_logic_unit#Status
 https://community.arm.com/groups/processors/blog/2012/09/24/8-bit-
versus-32-bit-mcus--the-impassioned-debate-goes-on
 https://en.wikipedia.org/wiki/ARM_architecture
 http://www.arm.com/products/processors/instruction-set-
architectures/index.php
12/29/2016 188 Bit ALU
Any questions ?
12/29/2016 198 Bit ALU
12/29/2016 208 Bit ALU
12/29/2016 218 Bit ALU

Más contenido relacionado

La actualidad más candente

Architecture of 8086 Microprocessor
Architecture of 8086 Microprocessor  Architecture of 8086 Microprocessor
Architecture of 8086 Microprocessor
Mustapha Fatty
 
Fpga(field programmable gate array)
Fpga(field programmable gate array) Fpga(field programmable gate array)
Fpga(field programmable gate array)
Iffat Anjum
 
Minimum Modes and Maximum Modes of 8086 Microprocessor
Minimum Modes and Maximum Modes of 8086 MicroprocessorMinimum Modes and Maximum Modes of 8086 Microprocessor
Minimum Modes and Maximum Modes of 8086 Microprocessor
Nikhil Kumar
 

La actualidad más candente (20)

Verilog
VerilogVerilog
Verilog
 
Data flow model -Lecture-4
Data flow model -Lecture-4Data flow model -Lecture-4
Data flow model -Lecture-4
 
AHB To APB BRIDGE.pptx
AHB To APB BRIDGE.pptxAHB To APB BRIDGE.pptx
AHB To APB BRIDGE.pptx
 
Verilog lab manual (ECAD and VLSI Lab)
Verilog lab manual (ECAD and VLSI Lab)Verilog lab manual (ECAD and VLSI Lab)
Verilog lab manual (ECAD and VLSI Lab)
 
Architecture of 8086 Microprocessor
Architecture of 8086 Microprocessor  Architecture of 8086 Microprocessor
Architecture of 8086 Microprocessor
 
Fpga(field programmable gate array)
Fpga(field programmable gate array) Fpga(field programmable gate array)
Fpga(field programmable gate array)
 
Pic microcontroller architecture
Pic microcontroller architecturePic microcontroller architecture
Pic microcontroller architecture
 
Shifters
ShiftersShifters
Shifters
 
verilog code for logic gates
verilog code for logic gatesverilog code for logic gates
verilog code for logic gates
 
Multipliers in VLSI
Multipliers in VLSIMultipliers in VLSI
Multipliers in VLSI
 
Interrupts in pic
Interrupts in picInterrupts in pic
Interrupts in pic
 
Introduction to ARM LPC2148
Introduction to ARM LPC2148Introduction to ARM LPC2148
Introduction to ARM LPC2148
 
Field Programmable Gate Array: Building Blocks and Interconnections
Field Programmable Gate Array: Building Blocks and InterconnectionsField Programmable Gate Array: Building Blocks and Interconnections
Field Programmable Gate Array: Building Blocks and Interconnections
 
Verilog Test Bench
Verilog Test BenchVerilog Test Bench
Verilog Test Bench
 
Verilog presentation final
Verilog presentation finalVerilog presentation final
Verilog presentation final
 
Session 2,3 FPGAs
Session 2,3 FPGAsSession 2,3 FPGAs
Session 2,3 FPGAs
 
Embedded C programming based on 8051 microcontroller
Embedded C programming based on 8051 microcontrollerEmbedded C programming based on 8051 microcontroller
Embedded C programming based on 8051 microcontroller
 
Minimum Modes and Maximum Modes of 8086 Microprocessor
Minimum Modes and Maximum Modes of 8086 MicroprocessorMinimum Modes and Maximum Modes of 8086 Microprocessor
Minimum Modes and Maximum Modes of 8086 Microprocessor
 
Design and implementation of 32 bit alu using verilog
Design and implementation of 32 bit alu using verilogDesign and implementation of 32 bit alu using verilog
Design and implementation of 32 bit alu using verilog
 
Overview of digital design with Verilog HDL
Overview of digital design with Verilog HDLOverview of digital design with Verilog HDL
Overview of digital design with Verilog HDL
 

Destacado

Day2.Combinational Logic
Day2.Combinational LogicDay2.Combinational Logic
Day2.Combinational Logic
Ron Liu
 
ECE_467_Final_Project_Report
ECE_467_Final_Project_ReportECE_467_Final_Project_Report
ECE_467_Final_Project_Report
Sidharth Kumar
 
Alu design-project
Alu design-projectAlu design-project
Alu design-project
alphankg1
 
8051 Microcontroller Notes
8051 Microcontroller Notes8051 Microcontroller Notes
8051 Microcontroller Notes
Dr.YNM
 

Destacado (12)

Alu description[1]
Alu description[1]Alu description[1]
Alu description[1]
 
Cadancesimulation
CadancesimulationCadancesimulation
Cadancesimulation
 
Day2.Combinational Logic
Day2.Combinational LogicDay2.Combinational Logic
Day2.Combinational Logic
 
ECE_467_Final_Project_Report
ECE_467_Final_Project_ReportECE_467_Final_Project_Report
ECE_467_Final_Project_Report
 
07 sequential verilog
07 sequential verilog07 sequential verilog
07 sequential verilog
 
Vhdl code and project report of arithmetic and logic unit
Vhdl code and project report of arithmetic and logic unitVhdl code and project report of arithmetic and logic unit
Vhdl code and project report of arithmetic and logic unit
 
ALU
ALUALU
ALU
 
VERILOG CODE
VERILOG CODEVERILOG CODE
VERILOG CODE
 
Alu design-project
Alu design-projectAlu design-project
Alu design-project
 
8051 Microcontroller Notes
8051 Microcontroller Notes8051 Microcontroller Notes
8051 Microcontroller Notes
 
Evolution Of Microprocessors
Evolution Of MicroprocessorsEvolution Of Microprocessors
Evolution Of Microprocessors
 
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
 

Similar a 8 Bit ALU

Single elctron transisto PHASE 2.pptx
Single elctron transisto PHASE 2.pptxSingle elctron transisto PHASE 2.pptx
Single elctron transisto PHASE 2.pptx
ssuser1580e5
 

Similar a 8 Bit ALU (20)

Architecture of 8085
Architecture of  8085Architecture of  8085
Architecture of 8085
 
8085 architecture
8085 architecture8085 architecture
8085 architecture
 
Dee2034 chapter 6 register
Dee2034 chapter 6 registerDee2034 chapter 6 register
Dee2034 chapter 6 register
 
8085 alp programs
8085 alp programs8085 alp programs
8085 alp programs
 
adders(1)
adders(1)adders(1)
adders(1)
 
2. 8085-Microprocessor.pptx
2. 8085-Microprocessor.pptx2. 8085-Microprocessor.pptx
2. 8085-Microprocessor.pptx
 
Analog to Digital Converter
Analog to Digital ConverterAnalog to Digital Converter
Analog to Digital Converter
 
EE2356 Microprocessor and Microcontroller Lab Manuel
EE2356 Microprocessor and Microcontroller Lab ManuelEE2356 Microprocessor and Microcontroller Lab Manuel
EE2356 Microprocessor and Microcontroller Lab Manuel
 
1.pdf
1.pdf1.pdf
1.pdf
 
8085_MicroelectronicAndMicroprocess.pdf
8085_MicroelectronicAndMicroprocess.pdf8085_MicroelectronicAndMicroprocess.pdf
8085_MicroelectronicAndMicroprocess.pdf
 
Chapter6-mikroprocessor
Chapter6-mikroprocessorChapter6-mikroprocessor
Chapter6-mikroprocessor
 
PPT 8085 microprocessor
PPT 8085 microprocessor PPT 8085 microprocessor
PPT 8085 microprocessor
 
8085 instruction-set part 1
8085 instruction-set part 18085 instruction-set part 1
8085 instruction-set part 1
 
8085 micro processor
8085 micro processor8085 micro processor
8085 micro processor
 
8085 microprocessor Architecture and pin description
8085 microprocessor Architecture and pin description 8085 microprocessor Architecture and pin description
8085 microprocessor Architecture and pin description
 
SynergieCAD-V93K-CTH-Configuration_MAR16
SynergieCAD-V93K-CTH-Configuration_MAR16SynergieCAD-V93K-CTH-Configuration_MAR16
SynergieCAD-V93K-CTH-Configuration_MAR16
 
PIC16F877A C Programming.ppt
PIC16F877A C Programming.pptPIC16F877A C Programming.ppt
PIC16F877A C Programming.ppt
 
Lecture 04 Logical Group of Instructions
Lecture 04 Logical Group of InstructionsLecture 04 Logical Group of Instructions
Lecture 04 Logical Group of Instructions
 
Intel 8085 mp
Intel 8085 mpIntel 8085 mp
Intel 8085 mp
 
Single elctron transisto PHASE 2.pptx
Single elctron transisto PHASE 2.pptxSingle elctron transisto PHASE 2.pptx
Single elctron transisto PHASE 2.pptx
 

8 Bit ALU

  • 1. 8 Bit ALU Presented By : Chirag Vaidya (16MECV27) Yash Nagaria (16MECV15) 12/29/2016 18 Bit ALU Guided By : Dr. N. P. Gajjar
  • 2. Contents :  ALU Introduction  Block Diagram  Flowchart  Verilog Code  Test bench  Simulation  Synthesis report  Device Utilization Summary  Final Report  Power and Thermal analysis  Future scope 12/29/2016 28 Bit ALU
  • 3. ALU Introduction :  An arithmetic logic unit is a digital circuit used to perform arithmetic and logic operations.  The following operations can be performed in ALU :  Addition  Subtraction  Bitwise AND  Bitwise OR  Bitwise NOT  Bitwise XOR  Shift Left, Shift Right  Rotate Left with Carry, Rotate Right Carry  Checking the status of these flags C, AC, Z, S, P 12/29/2016 38 Bit ALU
  • 4. Block Diagram of ALU : A B Operation Selection CMP--++ RLRRSLSR AND OR NOT EX- OR Out C Z S AC Arithmetic and Logical operationregister out 12/29/2016 48 Bit ALU
  • 5. Flow chart : Start Enter Data A , B S!=0 to 10 Output Display (invalid sel) Sel = 0 to 10 yes no 12/29/2016 58 Bit ALU
  • 6. Verilog Code : module alu8_bit(out , sel , C , AC , PE , S , Z); //input [7:0] A,B; input [3:0]sel; output reg [7:0] out ; output reg C,AC,S,Z; output PE; reg [7:0] A = 8'b11000001; reg [7:0] B = 8'b00101001; always @(sel , A , B) begin case(sel) 0: out = A & B; // BITWISE AND 1: out = A | B; // BITWISE OR 2: out = ~A; // BITWISE NOT 3: out = A^B; // EX-OR 4: out = A>>1; // SHIFT RIGHT 5: out = A<<1; // SHIFT LEFT 12/29/2016 68 Bit ALU
  • 7. 6: begin C = A[0]; out = {C,A[7:1]}; // ROTATE RIGHT end 7: begin C = A[7]; out = {A[6:0],C}; // ROTATE LEFT end 8: begin {AC,out[3:0]} = A[3:0] + B[3:0] ; // Lower nibble addition with Auxillary Carry {C,out[7:4]} = A[7:4] + B[7:4] + AC; // Upper nibble addition with Carry S = out[7]; // Sign flag end 9: begin {AC,out[3:0]} = A[3:0] - B[3:0] ; // Lower nibble Subtraction with Auxillary Carry {C,out[7:4]} = A[7:4] - B[7:4] ; // Upper nibble Subtraction with Carry S = out[7]; // Sign flag end 12/29/2016 78 Bit ALU
  • 8. // For CMP instructuion 10: begin {C,out[7:0]} = A[7:0] - B[7:0] ; // Upper nibble Subtraction with Carry {AC,out[3:0]} = A[3:0] - B[3:0] ; S = out[7]; // Sign flag if(out== 8'b0000_0000) begin Z <=1'b1; $display("A is equal to B"); end else if (C==0) begin $display("A is greater than B"); end else if (C==1) begin $display("A is less than B"); end end default : $display("PLease enter valid selection"); endcase 12/29/2016 88 Bit ALU
  • 9. if (out == 8'b0000_0000) begin Z <= 1'b1; end else begin Z <= 1'b0; end end even_parity m0(PE,A); endmodule module even_parity(out , in); input [7:0]in; output out; assign out=(in[0]^in[1]^in[2]^in[3]^in[4]^in[5]^in[6]^in[7]); endmodule 12/29/2016 98 Bit ALU
  • 10. Test bench : module alu; // Inputs reg [3:0] sel; reg [7:0] A; reg [7:0] B; // Outputs wire [7:0] out; wire C; wire AC; wire PE; wire S; wire Z; // Instantiate the Unit Under Test (UUT) alu8_bit uut ( .out(out), .sel(sel), .C(C), .AC(AC), .PE(PE), .S(S), .Z(Z), .A(A), .B(B) ); 12/29/2016 108 Bit ALU
  • 11. initial begin // Initialize Inputs sel = 0000; A = 8'b11001001; B = 8'b10001001; #1000 sel = 0; #1000 sel = 1; #1000 sel = 2; #1000 sel = 3; #1000 sel = 4; #1000 sel = 5; #1000 sel = 6; #1000 sel = 7; #1000 sel = 8; #1000 sel = 9; #1000 sel = 10; #1000; // Add stimulus here end endmodule 12/29/2016 118 Bit ALU
  • 13. Synthesis report : HDL Synthesis Report Macro Statistics # Adders/Subtractors : 5 4-bit adder carry in/out : 1 4-bit adder carry out : 1 5-bit subtractor : 2 9-bit subtractor : 1 # Latches : 11 1-bit latch : 11 # Multiplexers : 8 1-bit 11-to-1 multiplexer : 8 # Xors : 9 1-bit xor2 : 8 1-bit xor8 : 1 12/29/2016 138 Bit ALU
  • 14. Device Utilization Summary : 12/29/2016 148 Bit ALU
  • 15. Final report : Cell Usage : # GND : 1 # LUT2 : 15 # LUT3 : 21 # LUT4 : 63 # VCC : 1 # XORCY : 9 # Flip-flops/Latches : 19 # IO Buffers : 33 # IBUF : 20 # OBUF : 13 RTL Top Level Output File Name : alu8_bit.ngr Top Level Output File Name : alu8_bit Output Format : NGC Optimization Goal : Speed Keep Hierarchy : No Design Statistics IOs : 33 12/29/2016 158 Bit ALU
  • 16. Power and Thermal Analysis : 12/29/20168 Bit ALU 16
  • 17. Future Scope :  We have designed 8 bit ALU , which can be used in many 8 bit µprocessor or µcontroller , also in SoC .  We can do parallel processing operations using pipelining concept . 12/29/2016 178 Bit ALU
  • 18. References :  https://en.wikipedia.org/wiki/Arithmetic_logic_unit#Status  https://community.arm.com/groups/processors/blog/2012/09/24/8-bit- versus-32-bit-mcus--the-impassioned-debate-goes-on  https://en.wikipedia.org/wiki/ARM_architecture  http://www.arm.com/products/processors/instruction-set- architectures/index.php 12/29/2016 188 Bit ALU