SlideShare une entreprise Scribd logo
1  sur  12
Télécharger pour lire hors ligne
-

ASSIGNMENT-5
BY KANERIA DHAVAL
Verilog Code For Single Cycle Processor
DATAPATH WITH CONTROLLER

PC VERILOG CODE
module ProgramCounter
(
input [4:0]d_in,
input reset, clk,
output reg [4:0] d_out
);
always @(posedge clk)
if (reset)
d_out <= 5'b00000;
else
d_out <= d_in;
endmodule

AC VERILOG CODE
-

module Accumulator
(input [7:0] d_in,
input load, clk,
output reg [7:0] d_out
);
always @(posedge clk)
if (load)
d_out <= d_in;
initial
d_out=8'h00;
endmodule

ALU VERILOG CODE
module ALU
(
input [7:0]a, input [7:0]b,input [2:0]opcode,
output reg [7:0]alu_out
);
always @(opcode,a,b)
case(opcode)
3'b000:alu_out = a + b;
3'b001:alu_out = a - b;
3'b010:alu_out = a&b;
3'b011:alu_out = a|b;
3'b100:alu_out = ~b;
3'b101:alu_out = a^b;
3'b110:alu_out = a~^b;
default:alu_out = 0;
endcase
endmodule

ADDER VERILOG CODE
module CounterIncrement
(
input [4:0]a, input [4:0]b,
output[4:0] adder_out
);
assign adder_out = a + b;
endmodule
-

MUX-1 VERILOG CODE
module Mux2to1_6Bit
(
input [4:0] i0, i1,input sel,
output[4:0] mux_out
);
assign mux_out = sel ? i1 : i0;
endmodule

MUX-2 VERILOG CODE
module Mux2to1_8Bit
(
input [7:0]i0,i1,input sel,
output [7:0]mux_out
);
assign mux_out =sel?i1:i0;
endmodule

CONTROLLER VERILOG CODE
module Controller(
input [2:0] opcode,
output reg rd_mem,wr_mem,ac_src,ld_ac,pc_src,jmp_uncond);
always @(opcode)
begin
rd_mem = 1'b0;
wr_mem = 1'b0;
ac_src = 1'b0;
pc_src = 1'b0;
ld_ac = 1'b0;
jmp_uncond=1'b0;
case (opcode)
3'b000: //load accumulator from memory
begin
rd_mem = 1'b1;
wr_mem = 1'b0;
ld_ac = 1'b1;
ac_src = 1'b0;
end
-

3'b001:
begin
rd_mem = 1'b1;
wr_mem = 1'b0;
ld_ac = 1'b1;
ac_src = 1'b0;//SUBTRACT
end
3'b010:
begin
rd_mem = 1'b1;
wr_mem = 1'b0;
ld_ac = 1'b1;
ac_src = 1'b0;//AND
end
3'b011:
begin
rd_mem = 1'b1;
wr_mem = 1'b0;
ld_ac = 1'b1;
ac_src = 1'b0;//OR
end
3'b100:
begin
rd_mem = 1'b1;
wr_mem = 1'b0;
ld_ac = 1'b1;
ac_src = 1'b0;//NOT
end
3'b101:
begin
rd_mem = 1'b1;
wr_mem = 1'b0;
ld_ac = 1'b1;
ac_src = 1'b0;//XOR
end
3'b110:
begin
rd_mem = 1'b1;
wr_mem = 1'b0;
ld_ac = 1'b1;
ac_src = 1'b0;//XNOR
end
3'b111:
begin
-

rd_mem = 1'b0;
wr_mem = 1'b0;
ld_ac = 1'b0;
ac_src = 1'b0;
pc_src=1'b1;
jmp_uncond=1'b1;//JUMP
end
default:
begin
rd_mem = 1'b0;
wr_mem = 1'b0;
ac_src = 1'b0;
pc_src = 1'b0;
ld_ac = 1'b0;
end
endcase //end case
end //end always
endmodule

DATA MEMORY VERILOG CODE
module DataMemory (
input rd, wr,
input [4:0] abus,
input [7:0] in_dbus,
output reg [7:0] out_dbus);
reg [7:0] dm_array [0:31];
always @(rd,abus)
begin
if (rd)
out_dbus = dm_array [abus];
end
always @(wr,in_dbus) //always @(wr or abus or in_dbus)
begin
if (wr)
dm_array [abus] = in_dbus;
end
-

initial
begin
dm_array[0] = 8'h01;
dm_array[1] = 8'h02;
dm_array[2] = 8'h03;
dm_array[3] = 8'h04;
dm_array[4] = 8'h05;
end
endmodule

INSTRUCTION MEMORY VERILOG CODE
module InstructionMemory (input [4:0] abus, output reg [7:0] dbus);
reg [7:0] im_array [0:12];
always @(abus)
dbus = im_array [abus];
initial
begin
im_array[0]= 8'h00; // Initialize Accumulator with 0 and do addition with content of DataMemory at address 0.
im_array[1]= 8'h21; // Subtract content of accumulator with content of DataMemory at address 1.
im_array[2]= 8'h42; // Logical AND of accumulator with content of DataMemory at address 2.
im_array[3]= 8'h63; // Logical OR of accumulator with content of DataMemory at address 3.
im_array[4]= 8'h84; // Logical NOT of accumulator with content of DataMemory at address 4.
im_array[5]= 8'hA4; // Logical XOR of accumulator with content of DataMemory at address 4.
im_array[6]= 8'hC4; // Logical XNOR of accumulator with content of DataMemory at address 4.
im_array[7]= 8'hEA; // Unconditional Jump to 01010 address of Instruction memory.
im_array[10]= 8'h00; // Addition with content of DataMemory at address 0.
im_array[11]= 8'hE0; // Unconditional Jump to 00000 address of Instruction memory.
end
endmodule
-

DATAPATH MEMORY VERILOG CODE
module DataPath (
input reset,ld_ac, ac_src, pc_src, clk,
output [2:0] opcode,
output [4:0] im_abus,
input [7:0] im_dbus,
output [4:0] dm_abus,
output [7:0] dm_in_dbus,
input [7:0] dm_out_dbus,
output [7:0] ac_out,alu_out);
//wire [7:0] ac_out,alu_out,mux2_out;
wire [7:0]mux2_out;
wire [4:0] pc_out, adder_out,mux1_out;
ProgramCounter pc(.d_in(mux1_out),.reset(reset),.clk(clk),.d_out(pc_out)); //instantiation
of all module
CounterIncrement adder(.a(pc_out),.b(5'b00001),.adder_out(adder_out));
Mux2to1_6Bit
mux1(.i0(adder_out),.i1(im_dbus[4:0]),.sel(pc_src),.mux_out(mux1_out));
Accumulator
ac(.d_in(mux2_out),.load(ld_ac),.clk(clk),.d_out(ac_out));
ALU
alu(.a(ac_out),.b(dm_out_dbus),.opcode(opcode),.alu_out(alu_out));
Mux2to1_8Bit
mux2(.i0(alu_out),.i1(dm_out_dbus),.sel(ac_src),.mux_out(mux2_out));
assign im_abus = pc_out;
//assign im_abus = 6'b000000;
assign opcode = im_dbus [7:5];
assign dm_abus = im_dbus [4:0]; //abus for DataMemory.
assign dm_in_dbus=ac_out;
endmodule

SMPL. CPU MEMORY VERILOG CODE
module CPU( //The CPU
input clk,reset,
output rd_mem,wr_mem,
output [4:0] im_abus, input [7:0] im_dbus,
output [4:0] dm_abus, output [7:0] dm_in_dbus,
input [7:0] dm_out_dbus,
output [7:0] ac_out,alu_out,
output [2:0] opcode);
//wire [2:0] opcode;
-

wire ac_src,ld_ac, pc_src,jmp_uncond;
DataPath dpu
(.reset(reset),.ld_ac(ld_ac),.ac_src(ac_src),.pc_src(pc_src),.clk(clk),.opcode(opcode)
,.im_abus(im_abus),.im_dbus(im_dbus),.dm_abus(dm_abus),.dm_in_dbus(dm_in_dbus),.dm
_out_dbus(dm_out_dbus),.ac_out(ac_out),.alu_out(alu_out));//dj
Controller cu
(.opcode(opcode),.rd_mem(rd_mem),.wr_mem(wr_mem),.ac_src(ac_src),.ld_ac(ld_ac),
.pc_src(pc_src),.jmp_uncond(jmp_uncond));
endmodule

TEST BENCH SMPL. CPU MEMORY VERILOG CODE
module testBench;
reg clk;
reg reset;
wire [7:0] im_dbus;
wire [7:0] dm_out_dbus;

wire rd_mem;
wire wr_mem;
wire [4:0] im_abus;
wire [4:0] dm_abus;
wire [7:0] dm_in_dbus;
wire [7:0] ac_out,alu_out;
wire [2:0] opcode;

CPU uut (
.clk(clk),.reset(reset),.rd_mem(rd_mem),.wr_mem(wr_mem),
.im_abus(im_abus),.im_dbus(im_dbus),.dm_abus(dm_abus),
.dm_in_dbus(dm_in_dbus),.dm_out_dbus(dm_out_dbus),.ac_out(ac_out),.alu_out(alu
_out),.opcode(opcode));
InstructionMemory IM (.abus(im_abus),.dbus(im_dbus));
-

DataMemory DM
(.rd(rd_mem),.wr(wr_mem),.abus(dm_abus),.in_dbus(dm_in_dbus),.out_dbus(dm_out_dbus)
);
initial
begin
clk = 0;
reset = 1;//im_dbus =8'hxx;dm_out_dbus = 8'b00000000;
#20 reset = 1'b0;
#500 $finish;
end
always
#10 clk = ~clk;
Endmodule
RTL DIAGRAM
-

Insideview of RTL

RTL OF CPU
-

RTL OF DATAPATH

Technology map
-

TEST BENCH WAVE FORM :
Data memory :
Location

00

01

02

03

04

Data

01

02

03

04

05

1

2

3

4

5

6

7

8

9

21

42

63

84

A4

C4

EA

00

E0

FF

05

06

Instruction memory :
Location

0

Instruction 00

(* operation with accumulator with location in last 5 bit)
Ans (in acc in hex) 00 01

FF

03

07

FA

07

Contenu connexe

Tendances

System verilog important
System verilog importantSystem verilog important
System verilog importantelumalai7
 
Day2 Verilog HDL Basic
Day2 Verilog HDL BasicDay2 Verilog HDL Basic
Day2 Verilog HDL BasicRon Liu
 
VLSI Design Flow
VLSI Design FlowVLSI Design Flow
VLSI Design FlowA B Shinde
 
Obstacle_Avoidance_Robot_Coruse_Project_ECET402_Mechatronics_FinalCopy
Obstacle_Avoidance_Robot_Coruse_Project_ECET402_Mechatronics_FinalCopyObstacle_Avoidance_Robot_Coruse_Project_ECET402_Mechatronics_FinalCopy
Obstacle_Avoidance_Robot_Coruse_Project_ECET402_Mechatronics_FinalCopyElijah Barner
 
Gate level design -For beginners
Gate level design -For beginnersGate level design -For beginners
Gate level design -For beginnersDr.YNM
 
Verilog coding of demux 8 x1
Verilog coding of demux  8 x1Verilog coding of demux  8 x1
Verilog coding of demux 8 x1Rakesh kumar jha
 
Verilog presentation final
Verilog presentation finalVerilog presentation final
Verilog presentation finalAnkur Gupta
 
Mastering Microcontroller : TIMERS, PWM, CAN, RTC,LOW POWER
Mastering Microcontroller : TIMERS, PWM, CAN, RTC,LOW POWERMastering Microcontroller : TIMERS, PWM, CAN, RTC,LOW POWER
Mastering Microcontroller : TIMERS, PWM, CAN, RTC,LOW POWERFastBit Embedded Brain Academy
 
structural modeling, hazards
structural modeling, hazardsstructural modeling, hazards
structural modeling, hazardsdennis gookyi
 
Advd lecture 7 logical effort
Advd   lecture 7 logical effortAdvd   lecture 7 logical effort
Advd lecture 7 logical effortHardik Gupta
 
Microprocessor chapter 9 - assembly language programming
Microprocessor  chapter 9 - assembly language programmingMicroprocessor  chapter 9 - assembly language programming
Microprocessor chapter 9 - assembly language programmingWondeson Emeye
 

Tendances (20)

System verilog important
System verilog importantSystem verilog important
System verilog important
 
Day2 Verilog HDL Basic
Day2 Verilog HDL BasicDay2 Verilog HDL Basic
Day2 Verilog HDL Basic
 
VLSI Design Flow
VLSI Design FlowVLSI Design Flow
VLSI Design Flow
 
Obstacle_Avoidance_Robot_Coruse_Project_ECET402_Mechatronics_FinalCopy
Obstacle_Avoidance_Robot_Coruse_Project_ECET402_Mechatronics_FinalCopyObstacle_Avoidance_Robot_Coruse_Project_ECET402_Mechatronics_FinalCopy
Obstacle_Avoidance_Robot_Coruse_Project_ECET402_Mechatronics_FinalCopy
 
Verilog hdl
Verilog hdlVerilog hdl
Verilog hdl
 
Gate level design -For beginners
Gate level design -For beginnersGate level design -For beginners
Gate level design -For beginners
 
Verilog coding of demux 8 x1
Verilog coding of demux  8 x1Verilog coding of demux  8 x1
Verilog coding of demux 8 x1
 
7 8255
7 82557 8255
7 8255
 
VERILOG CODE
VERILOG CODEVERILOG CODE
VERILOG CODE
 
Verilog presentation final
Verilog presentation finalVerilog presentation final
Verilog presentation final
 
Mastering Microcontroller : TIMERS, PWM, CAN, RTC,LOW POWER
Mastering Microcontroller : TIMERS, PWM, CAN, RTC,LOW POWERMastering Microcontroller : TIMERS, PWM, CAN, RTC,LOW POWER
Mastering Microcontroller : TIMERS, PWM, CAN, RTC,LOW POWER
 
structural modeling, hazards
structural modeling, hazardsstructural modeling, hazards
structural modeling, hazards
 
Encoder decoder
Encoder decoderEncoder decoder
Encoder decoder
 
ARM lab programs
ARM  lab programs  ARM  lab programs
ARM lab programs
 
Ch12 microprocessor interrupts
Ch12 microprocessor interruptsCh12 microprocessor interrupts
Ch12 microprocessor interrupts
 
Verilog
VerilogVerilog
Verilog
 
Advd lecture 7 logical effort
Advd   lecture 7 logical effortAdvd   lecture 7 logical effort
Advd lecture 7 logical effort
 
interrupts of 8051.pdf
interrupts of 8051.pdfinterrupts of 8051.pdf
interrupts of 8051.pdf
 
Embedded C - Lecture 1
Embedded C - Lecture 1Embedded C - Lecture 1
Embedded C - Lecture 1
 
Microprocessor chapter 9 - assembly language programming
Microprocessor  chapter 9 - assembly language programmingMicroprocessor  chapter 9 - assembly language programming
Microprocessor chapter 9 - assembly language programming
 

En vedette

Mips implementation
Mips implementationMips implementation
Mips implementationhoang974
 
05 instruction set design and architecture
05 instruction set design and architecture05 instruction set design and architecture
05 instruction set design and architectureWaqar Jamil
 
Lec 12-15 mips instruction set processor
Lec 12-15 mips instruction set processorLec 12-15 mips instruction set processor
Lec 12-15 mips instruction set processorMayank Roy
 
Designing of 8 BIT Arithmetic and Logical Unit and implementing on Xilinx Ver...
Designing of 8 BIT Arithmetic and Logical Unit and implementing on Xilinx Ver...Designing of 8 BIT Arithmetic and Logical Unit and implementing on Xilinx Ver...
Designing of 8 BIT Arithmetic and Logical Unit and implementing on Xilinx Ver...Rahul Borthakur
 
Computer Architecture – An Introduction
Computer Architecture – An IntroductionComputer Architecture – An Introduction
Computer Architecture – An IntroductionDilum Bandara
 
Instruction Set Architecture
Instruction Set ArchitectureInstruction Set Architecture
Instruction Set ArchitectureDilum Bandara
 

En vedette (9)

Mips implementation
Mips implementationMips implementation
Mips implementation
 
06 mips-isa
06 mips-isa06 mips-isa
06 mips-isa
 
8 bit alu design
8 bit alu design8 bit alu design
8 bit alu design
 
Case study of digital camera
Case study of digital cameraCase study of digital camera
Case study of digital camera
 
05 instruction set design and architecture
05 instruction set design and architecture05 instruction set design and architecture
05 instruction set design and architecture
 
Lec 12-15 mips instruction set processor
Lec 12-15 mips instruction set processorLec 12-15 mips instruction set processor
Lec 12-15 mips instruction set processor
 
Designing of 8 BIT Arithmetic and Logical Unit and implementing on Xilinx Ver...
Designing of 8 BIT Arithmetic and Logical Unit and implementing on Xilinx Ver...Designing of 8 BIT Arithmetic and Logical Unit and implementing on Xilinx Ver...
Designing of 8 BIT Arithmetic and Logical Unit and implementing on Xilinx Ver...
 
Computer Architecture – An Introduction
Computer Architecture – An IntroductionComputer Architecture – An Introduction
Computer Architecture – An Introduction
 
Instruction Set Architecture
Instruction Set ArchitectureInstruction Set Architecture
Instruction Set Architecture
 

Similaire à 8 bit single cycle processor

망고100 보드로 놀아보자 15
망고100 보드로 놀아보자 15망고100 보드로 놀아보자 15
망고100 보드로 놀아보자 15종인 전
 
How do I draw the Labview code for pneumatic cylinder(air pistion). .pdf
How do I draw the Labview code for pneumatic cylinder(air pistion). .pdfHow do I draw the Labview code for pneumatic cylinder(air pistion). .pdf
How do I draw the Labview code for pneumatic cylinder(air pistion). .pdffootstatus
 
Windbg랑 친해지기
Windbg랑 친해지기Windbg랑 친해지기
Windbg랑 친해지기Ji Hun Kim
 
What will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfWhat will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfSIGMATAX1
 
ISCA Final Presentaiton - Compilations
ISCA Final Presentaiton -  CompilationsISCA Final Presentaiton -  Compilations
ISCA Final Presentaiton - CompilationsHSA Foundation
 
0.my book draft chap 1
0.my book draft chap 10.my book draft chap 1
0.my book draft chap 1manhduc1811
 
Gaztea Tech Robotica 2016
Gaztea Tech Robotica 2016Gaztea Tech Robotica 2016
Gaztea Tech Robotica 2016Svet Ivantchev
 
2.1 ### uVision Project, (C) Keil Software .docx
2.1   ### uVision Project, (C) Keil Software    .docx2.1   ### uVision Project, (C) Keil Software    .docx
2.1 ### uVision Project, (C) Keil Software .docxtarifarmarie
 
Rootkit on Linux X86 v2.6
Rootkit on Linux X86 v2.6Rootkit on Linux X86 v2.6
Rootkit on Linux X86 v2.6fisher.w.y
 
Microcontroladores: programas de CCS Compiler.docx
Microcontroladores: programas de CCS Compiler.docxMicrocontroladores: programas de CCS Compiler.docx
Microcontroladores: programas de CCS Compiler.docxSANTIAGO PABLO ALBERTO
 
Rootkit on linux_x86_v2.6
Rootkit on linux_x86_v2.6Rootkit on linux_x86_v2.6
Rootkit on linux_x86_v2.6scuhurricane
 
Assignment no39
Assignment no39Assignment no39
Assignment no39Jay Patel
 
CUDA lab's slides of "parallel programming" course
CUDA lab's slides of "parallel programming" courseCUDA lab's slides of "parallel programming" course
CUDA lab's slides of "parallel programming" courseShuai Yuan
 
vlsi design using verilog presentaion 1
vlsi design using verilog   presentaion 1vlsi design using verilog   presentaion 1
vlsi design using verilog presentaion 1MANDHASAIGOUD1
 
Roberto Gallea: Workshop Arduino, giorno #2 Arduino + Processing
Roberto Gallea: Workshop Arduino, giorno #2 Arduino + ProcessingRoberto Gallea: Workshop Arduino, giorno #2 Arduino + Processing
Roberto Gallea: Workshop Arduino, giorno #2 Arduino + ProcessingDemetrio Siragusa
 

Similaire à 8 bit single cycle processor (20)

망고100 보드로 놀아보자 15
망고100 보드로 놀아보자 15망고100 보드로 놀아보자 15
망고100 보드로 놀아보자 15
 
How do I draw the Labview code for pneumatic cylinder(air pistion). .pdf
How do I draw the Labview code for pneumatic cylinder(air pistion). .pdfHow do I draw the Labview code for pneumatic cylinder(air pistion). .pdf
How do I draw the Labview code for pneumatic cylinder(air pistion). .pdf
 
Windbg랑 친해지기
Windbg랑 친해지기Windbg랑 친해지기
Windbg랑 친해지기
 
What will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfWhat will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdf
 
ISCA Final Presentaiton - Compilations
ISCA Final Presentaiton -  CompilationsISCA Final Presentaiton -  Compilations
ISCA Final Presentaiton - Compilations
 
0.my book draft chap 1
0.my book draft chap 10.my book draft chap 1
0.my book draft chap 1
 
Gaztea Tech Robotica 2016
Gaztea Tech Robotica 2016Gaztea Tech Robotica 2016
Gaztea Tech Robotica 2016
 
2.1 ### uVision Project, (C) Keil Software .docx
2.1   ### uVision Project, (C) Keil Software    .docx2.1   ### uVision Project, (C) Keil Software    .docx
2.1 ### uVision Project, (C) Keil Software .docx
 
Der perfekte 12c trigger
Der perfekte 12c triggerDer perfekte 12c trigger
Der perfekte 12c trigger
 
An Example MIPS
An Example  MIPSAn Example  MIPS
An Example MIPS
 
Rootkit on Linux X86 v2.6
Rootkit on Linux X86 v2.6Rootkit on Linux X86 v2.6
Rootkit on Linux X86 v2.6
 
Lampiran 1.programdocx
Lampiran 1.programdocxLampiran 1.programdocx
Lampiran 1.programdocx
 
Microcontroladores: programas de CCS Compiler.docx
Microcontroladores: programas de CCS Compiler.docxMicrocontroladores: programas de CCS Compiler.docx
Microcontroladores: programas de CCS Compiler.docx
 
Rootkit on linux_x86_v2.6
Rootkit on linux_x86_v2.6Rootkit on linux_x86_v2.6
Rootkit on linux_x86_v2.6
 
Joel Falcou, Boost.SIMD
Joel Falcou, Boost.SIMDJoel Falcou, Boost.SIMD
Joel Falcou, Boost.SIMD
 
Assignment no39
Assignment no39Assignment no39
Assignment no39
 
CUDA lab's slides of "parallel programming" course
CUDA lab's slides of "parallel programming" courseCUDA lab's slides of "parallel programming" course
CUDA lab's slides of "parallel programming" course
 
PIC and LCD
PIC and LCDPIC and LCD
PIC and LCD
 
vlsi design using verilog presentaion 1
vlsi design using verilog   presentaion 1vlsi design using verilog   presentaion 1
vlsi design using verilog presentaion 1
 
Roberto Gallea: Workshop Arduino, giorno #2 Arduino + Processing
Roberto Gallea: Workshop Arduino, giorno #2 Arduino + ProcessingRoberto Gallea: Workshop Arduino, giorno #2 Arduino + Processing
Roberto Gallea: Workshop Arduino, giorno #2 Arduino + Processing
 

Plus de Dhaval Kaneria

Objective-C for iOS Application Development
Objective-C for iOS Application DevelopmentObjective-C for iOS Application Development
Objective-C for iOS Application DevelopmentDhaval Kaneria
 
Gpu with cuda architecture
Gpu with cuda architectureGpu with cuda architecture
Gpu with cuda architectureDhaval Kaneria
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and AlgorithmDhaval Kaneria
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and AlgorithmDhaval Kaneria
 
Serial Peripheral Interface(SPI)
Serial Peripheral Interface(SPI)Serial Peripheral Interface(SPI)
Serial Peripheral Interface(SPI)Dhaval Kaneria
 
Linux booting procedure
Linux booting procedureLinux booting procedure
Linux booting procedureDhaval Kaneria
 
Linux booting procedure
Linux booting procedureLinux booting procedure
Linux booting procedureDhaval Kaneria
 
Manage Xilinx ISE 14.5 licence for Windows 8 and 8.1
Manage Xilinx ISE 14.5 licence for Windows 8 and 8.1Manage Xilinx ISE 14.5 licence for Windows 8 and 8.1
Manage Xilinx ISE 14.5 licence for Windows 8 and 8.1Dhaval Kaneria
 
Paper on Optimized AES Algorithm Core Using FeedBack Architecture
Paper on Optimized AES Algorithm Core Using  FeedBack Architecture Paper on Optimized AES Algorithm Core Using  FeedBack Architecture
Paper on Optimized AES Algorithm Core Using FeedBack Architecture Dhaval Kaneria
 
PAPER ON MEMS TECHNOLOGY
PAPER ON MEMS TECHNOLOGYPAPER ON MEMS TECHNOLOGY
PAPER ON MEMS TECHNOLOGYDhaval Kaneria
 
VIdeo Compression using sum of Absolute Difference
VIdeo Compression using sum of Absolute DifferenceVIdeo Compression using sum of Absolute Difference
VIdeo Compression using sum of Absolute DifferenceDhaval Kaneria
 

Plus de Dhaval Kaneria (19)

Swine flu
Swine flu Swine flu
Swine flu
 
Introduction of Xcode
Introduction of XcodeIntroduction of Xcode
Introduction of Xcode
 
Objective-C for iOS Application Development
Objective-C for iOS Application DevelopmentObjective-C for iOS Application Development
Objective-C for iOS Application Development
 
Gpu with cuda architecture
Gpu with cuda architectureGpu with cuda architecture
Gpu with cuda architecture
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
 
HDMI
HDMIHDMI
HDMI
 
Hdmi
HdmiHdmi
Hdmi
 
open source hardware
open source hardwareopen source hardware
open source hardware
 
Serial Peripheral Interface(SPI)
Serial Peripheral Interface(SPI)Serial Peripheral Interface(SPI)
Serial Peripheral Interface(SPI)
 
Linux booting procedure
Linux booting procedureLinux booting procedure
Linux booting procedure
 
Linux booting procedure
Linux booting procedureLinux booting procedure
Linux booting procedure
 
Manage Xilinx ISE 14.5 licence for Windows 8 and 8.1
Manage Xilinx ISE 14.5 licence for Windows 8 and 8.1Manage Xilinx ISE 14.5 licence for Windows 8 and 8.1
Manage Xilinx ISE 14.5 licence for Windows 8 and 8.1
 
Paper on Optimized AES Algorithm Core Using FeedBack Architecture
Paper on Optimized AES Algorithm Core Using  FeedBack Architecture Paper on Optimized AES Algorithm Core Using  FeedBack Architecture
Paper on Optimized AES Algorithm Core Using FeedBack Architecture
 
PAPER ON MEMS TECHNOLOGY
PAPER ON MEMS TECHNOLOGYPAPER ON MEMS TECHNOLOGY
PAPER ON MEMS TECHNOLOGY
 
VIdeo Compression using sum of Absolute Difference
VIdeo Compression using sum of Absolute DifferenceVIdeo Compression using sum of Absolute Difference
VIdeo Compression using sum of Absolute Difference
 
Mems technology
Mems technologyMems technology
Mems technology
 
Network security
Network securityNetwork security
Network security
 
Token bus standard
Token bus standardToken bus standard
Token bus standard
 

Dernier

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 

Dernier (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

8 bit single cycle processor

  • 1. - ASSIGNMENT-5 BY KANERIA DHAVAL Verilog Code For Single Cycle Processor DATAPATH WITH CONTROLLER PC VERILOG CODE module ProgramCounter ( input [4:0]d_in, input reset, clk, output reg [4:0] d_out ); always @(posedge clk) if (reset) d_out <= 5'b00000; else d_out <= d_in; endmodule AC VERILOG CODE
  • 2. - module Accumulator (input [7:0] d_in, input load, clk, output reg [7:0] d_out ); always @(posedge clk) if (load) d_out <= d_in; initial d_out=8'h00; endmodule ALU VERILOG CODE module ALU ( input [7:0]a, input [7:0]b,input [2:0]opcode, output reg [7:0]alu_out ); always @(opcode,a,b) case(opcode) 3'b000:alu_out = a + b; 3'b001:alu_out = a - b; 3'b010:alu_out = a&b; 3'b011:alu_out = a|b; 3'b100:alu_out = ~b; 3'b101:alu_out = a^b; 3'b110:alu_out = a~^b; default:alu_out = 0; endcase endmodule ADDER VERILOG CODE module CounterIncrement ( input [4:0]a, input [4:0]b, output[4:0] adder_out ); assign adder_out = a + b; endmodule
  • 3. - MUX-1 VERILOG CODE module Mux2to1_6Bit ( input [4:0] i0, i1,input sel, output[4:0] mux_out ); assign mux_out = sel ? i1 : i0; endmodule MUX-2 VERILOG CODE module Mux2to1_8Bit ( input [7:0]i0,i1,input sel, output [7:0]mux_out ); assign mux_out =sel?i1:i0; endmodule CONTROLLER VERILOG CODE module Controller( input [2:0] opcode, output reg rd_mem,wr_mem,ac_src,ld_ac,pc_src,jmp_uncond); always @(opcode) begin rd_mem = 1'b0; wr_mem = 1'b0; ac_src = 1'b0; pc_src = 1'b0; ld_ac = 1'b0; jmp_uncond=1'b0; case (opcode) 3'b000: //load accumulator from memory begin rd_mem = 1'b1; wr_mem = 1'b0; ld_ac = 1'b1; ac_src = 1'b0; end
  • 4. - 3'b001: begin rd_mem = 1'b1; wr_mem = 1'b0; ld_ac = 1'b1; ac_src = 1'b0;//SUBTRACT end 3'b010: begin rd_mem = 1'b1; wr_mem = 1'b0; ld_ac = 1'b1; ac_src = 1'b0;//AND end 3'b011: begin rd_mem = 1'b1; wr_mem = 1'b0; ld_ac = 1'b1; ac_src = 1'b0;//OR end 3'b100: begin rd_mem = 1'b1; wr_mem = 1'b0; ld_ac = 1'b1; ac_src = 1'b0;//NOT end 3'b101: begin rd_mem = 1'b1; wr_mem = 1'b0; ld_ac = 1'b1; ac_src = 1'b0;//XOR end 3'b110: begin rd_mem = 1'b1; wr_mem = 1'b0; ld_ac = 1'b1; ac_src = 1'b0;//XNOR end 3'b111: begin
  • 5. - rd_mem = 1'b0; wr_mem = 1'b0; ld_ac = 1'b0; ac_src = 1'b0; pc_src=1'b1; jmp_uncond=1'b1;//JUMP end default: begin rd_mem = 1'b0; wr_mem = 1'b0; ac_src = 1'b0; pc_src = 1'b0; ld_ac = 1'b0; end endcase //end case end //end always endmodule DATA MEMORY VERILOG CODE module DataMemory ( input rd, wr, input [4:0] abus, input [7:0] in_dbus, output reg [7:0] out_dbus); reg [7:0] dm_array [0:31]; always @(rd,abus) begin if (rd) out_dbus = dm_array [abus]; end always @(wr,in_dbus) //always @(wr or abus or in_dbus) begin if (wr) dm_array [abus] = in_dbus; end
  • 6. - initial begin dm_array[0] = 8'h01; dm_array[1] = 8'h02; dm_array[2] = 8'h03; dm_array[3] = 8'h04; dm_array[4] = 8'h05; end endmodule INSTRUCTION MEMORY VERILOG CODE module InstructionMemory (input [4:0] abus, output reg [7:0] dbus); reg [7:0] im_array [0:12]; always @(abus) dbus = im_array [abus]; initial begin im_array[0]= 8'h00; // Initialize Accumulator with 0 and do addition with content of DataMemory at address 0. im_array[1]= 8'h21; // Subtract content of accumulator with content of DataMemory at address 1. im_array[2]= 8'h42; // Logical AND of accumulator with content of DataMemory at address 2. im_array[3]= 8'h63; // Logical OR of accumulator with content of DataMemory at address 3. im_array[4]= 8'h84; // Logical NOT of accumulator with content of DataMemory at address 4. im_array[5]= 8'hA4; // Logical XOR of accumulator with content of DataMemory at address 4. im_array[6]= 8'hC4; // Logical XNOR of accumulator with content of DataMemory at address 4. im_array[7]= 8'hEA; // Unconditional Jump to 01010 address of Instruction memory. im_array[10]= 8'h00; // Addition with content of DataMemory at address 0. im_array[11]= 8'hE0; // Unconditional Jump to 00000 address of Instruction memory. end endmodule
  • 7. - DATAPATH MEMORY VERILOG CODE module DataPath ( input reset,ld_ac, ac_src, pc_src, clk, output [2:0] opcode, output [4:0] im_abus, input [7:0] im_dbus, output [4:0] dm_abus, output [7:0] dm_in_dbus, input [7:0] dm_out_dbus, output [7:0] ac_out,alu_out); //wire [7:0] ac_out,alu_out,mux2_out; wire [7:0]mux2_out; wire [4:0] pc_out, adder_out,mux1_out; ProgramCounter pc(.d_in(mux1_out),.reset(reset),.clk(clk),.d_out(pc_out)); //instantiation of all module CounterIncrement adder(.a(pc_out),.b(5'b00001),.adder_out(adder_out)); Mux2to1_6Bit mux1(.i0(adder_out),.i1(im_dbus[4:0]),.sel(pc_src),.mux_out(mux1_out)); Accumulator ac(.d_in(mux2_out),.load(ld_ac),.clk(clk),.d_out(ac_out)); ALU alu(.a(ac_out),.b(dm_out_dbus),.opcode(opcode),.alu_out(alu_out)); Mux2to1_8Bit mux2(.i0(alu_out),.i1(dm_out_dbus),.sel(ac_src),.mux_out(mux2_out)); assign im_abus = pc_out; //assign im_abus = 6'b000000; assign opcode = im_dbus [7:5]; assign dm_abus = im_dbus [4:0]; //abus for DataMemory. assign dm_in_dbus=ac_out; endmodule SMPL. CPU MEMORY VERILOG CODE module CPU( //The CPU input clk,reset, output rd_mem,wr_mem, output [4:0] im_abus, input [7:0] im_dbus, output [4:0] dm_abus, output [7:0] dm_in_dbus, input [7:0] dm_out_dbus, output [7:0] ac_out,alu_out, output [2:0] opcode); //wire [2:0] opcode;
  • 8. - wire ac_src,ld_ac, pc_src,jmp_uncond; DataPath dpu (.reset(reset),.ld_ac(ld_ac),.ac_src(ac_src),.pc_src(pc_src),.clk(clk),.opcode(opcode) ,.im_abus(im_abus),.im_dbus(im_dbus),.dm_abus(dm_abus),.dm_in_dbus(dm_in_dbus),.dm _out_dbus(dm_out_dbus),.ac_out(ac_out),.alu_out(alu_out));//dj Controller cu (.opcode(opcode),.rd_mem(rd_mem),.wr_mem(wr_mem),.ac_src(ac_src),.ld_ac(ld_ac), .pc_src(pc_src),.jmp_uncond(jmp_uncond)); endmodule TEST BENCH SMPL. CPU MEMORY VERILOG CODE module testBench; reg clk; reg reset; wire [7:0] im_dbus; wire [7:0] dm_out_dbus; wire rd_mem; wire wr_mem; wire [4:0] im_abus; wire [4:0] dm_abus; wire [7:0] dm_in_dbus; wire [7:0] ac_out,alu_out; wire [2:0] opcode; CPU uut ( .clk(clk),.reset(reset),.rd_mem(rd_mem),.wr_mem(wr_mem), .im_abus(im_abus),.im_dbus(im_dbus),.dm_abus(dm_abus), .dm_in_dbus(dm_in_dbus),.dm_out_dbus(dm_out_dbus),.ac_out(ac_out),.alu_out(alu _out),.opcode(opcode)); InstructionMemory IM (.abus(im_abus),.dbus(im_dbus));
  • 9. - DataMemory DM (.rd(rd_mem),.wr(wr_mem),.abus(dm_abus),.in_dbus(dm_in_dbus),.out_dbus(dm_out_dbus) ); initial begin clk = 0; reset = 1;//im_dbus =8'hxx;dm_out_dbus = 8'b00000000; #20 reset = 1'b0; #500 $finish; end always #10 clk = ~clk; Endmodule RTL DIAGRAM
  • 12. - TEST BENCH WAVE FORM : Data memory : Location 00 01 02 03 04 Data 01 02 03 04 05 1 2 3 4 5 6 7 8 9 21 42 63 84 A4 C4 EA 00 E0 FF 05 06 Instruction memory : Location 0 Instruction 00 (* operation with accumulator with location in last 5 bit) Ans (in acc in hex) 00 01 FF 03 07 FA 07