SlideShare a Scribd company logo
1 of 15
Download to read offline
Experiment No:9
Aim: To Implement counters.
NAME: Shyamveer Singh
SECTION: E1207
REG N0: 11205816
ROLL NO: B-54
Truth Table:
Up down counter:
Up counter:
Theory:
An up counter simply counts from 0 to 9. We
can use this circuit to make , This circuit can
also be used to make a digital clock.
Both Synchronous and Asynchronous counters
are capable of counting “Up” or counting
“Down”, but their is another more “Universal”
type of counter that can count in both directions
either Up or Down depending on the state of
their input control pin and these are known
as Bidirectional Counters.
Bidirectional counters, also known as a up
down counter.
PROGRAMME CODES
4bit up counter:
module fbuc(clk,reset,q);
input clk,reset;
output [3:0]q;
reg [3:0]q;
always@(clk)
begin if(reset)
q=0;
else if(reset==0&&q<15)
q=q+1;
end
endmodule
reset = 1;clk = 0;
// Wait 100 ns for global reset to
finish #10;
reset = 0;clk =
1; #10;
reset = 0;clk =
0; #10;
reset = 0;clk =
1; #10;
reset = 0;clk =
0; #10;
reset = 0;clk =
1; #10;
reset = 0;clk =
0; #10;
reset = 0;clk =
1; #10;
reset = 0;clk =
0; #10;
reset = 0;clk =
1; #10;
reset = 0;clk =
0; #10;
reset = 0;clk = 1;
#10;
reset = 0;clk =
0; #10;
reset = 0;clk =
1; #10;
reset = 0;clk =
0; #10;
reset = 0;clk =
1; #10;
// Add stimulus here
end
endmodule
// Initialize Inputs
reset = 1;clk = 0;
// Wait 100 ns for global reset to
finish #10;
reset = 0;clk =
1; #10;
reset = 0;clk =
0; #10;
reset = 0;clk =
1; #10;
reset = 0;clk =
0; #10;
reset = 0;clk =
1; #10;
reset = 0;clk =
0; #10;
reset = 0;clk =
1; #10;
reset = 0;clk =
0; #10;
reset = 0;clk =
1; #10;
reset = 0;clk =
0; #10;
reset = 0;clk =
1; #10;
reset = 0;clk =
0; #10;
reset = 0;clk =
1; #10;
reset = 0;clk =
0; #10;
reset = 0;clk =
1; #10;
// Add stimulus here
end
endmodule
4bit down counter
module fbdc(clk,reset,q);
input clk,reset;
output [3:0]q;
reg [3:0]q;
always@(clk)
begin if(reset)
q=15;
else if(reset==0&&q>0)
q=q-1;
end
endmodule
reset = 1;clk = 0;
// Wait 100 ns for global reset to
finish #10;
reset = 0;clk =
1; #10;
reset = 0;clk =
0; #10;
reset = 0;clk =
1; #10;
reset = 0;clk =
0; #10;
reset = 0;clk =
1; #10;
reset = 0;clk =
0; #10;
reset = 0;clk =
1; #10;
reset = 0;clk =
0; #10;
reset = 0;clk =
1; #10;
reset = 0;clk = 0;
#10;
reset = 0;clk =
1; #10;
reset = 0;clk =
0; #10;
reset = 0;clk =
1; #10;
reset = 0;clk =
0; #10;
reset = 0;clk =
1; #10;
reset = 0;clk =
0; #10;
reset = 0;clk = 1;
#10;
// Add stimulus here
end
endmodule
4b Up down counter
module fbudc(clk,reset,up,dn,q);
input clk,up,dn,reset;
output [3:0]q;
reg [3:0]q;
always@(clk)
begin
if (reset)
q=0;
else if(up)
q=q+1;
else if(dn)
q=q-1; end
endmodule
clk = 0;
reset = 1;
up = 1;
dn = 0;
// Wait 100 ns for global reset to
finish #10;
clk = 1;
reset =
0; up =
1; dn =
0; #10;
clk = 0;
reset =
0; up =
1; dn =
0; #10;
clk = 1;
reset =
0; up =
1; dn =
0; #10;
clk = 0;
reset =
0; up =
1; dn =
0; #10;
clk = 1;
reset =
0; up =
1; dn =
0; #10;
clk = 0;
reset =
0; up =
1; dn =
0; #10;
clk = 1;
reset =
0; up =
1; dn =
0; #10;
clk = 0;
reset =
0; up =
1; dn =
0; #10;
clk = 1;
reset =
0; up =
1; dn =
0; #10;
clk = 0;
reset =
0; up =
1; dn =
0; #10;
clk = 1;
reset =
0; up =
1; dn =
0; #10;
clk = 0;
reset =
0; up =
1; dn =
0; #10;
clk = 1;
reset =
0; up =
1; dn =
0; #10;
clk = 0;
reset =
0; up =
1; dn =
0; #10;
clk = 1;
reset =
0; up =
1; dn =
0; #10;
clk = 1;
reset =
0; up =
0; dn =
1; #10;
clk = 0;
reset =
0; up =
0; dn =
1; #10;
clk = 1;
reset =
0; up =
0; dn =
1; #10;
clk = 0;
reset =
0; up =
0; dn =
1; #10;
clk = 1;
reset =
0; up =
0; dn =
1; #10;
clk = 0;
reset =
0; up =
0; dn =
1; #10;
clk = 1;
reset =
0; up =
0; dn =
1; #10;
clk = 0;
reset = 0;
up = 0;
dn = 1;
#10;
clk = 1;
reset =
0; up =
0; dn =
1; #10;
clk = 0;
reset =
0; up =
0; dn =
1; #10;
clk = 1;
reset =
0; up =
0; dn =
1; #10;
clk = 0;
reset =
0; up =
0; dn =
1; #10;
clk = 1;
reset =
0; up =
0; dn =
1; #10;
clk = 0;
reset =
0; up =
0; dn =
1; #10;
clk = 1;
reset =
0; up =
0; dn =
1; #10;
clk = 0;
reset =
0; up =
0; dn =
1; #10;
// Add stimulus here
end
endmodule
To designing counters using verilog code

More Related Content

What's hot

Csl 202, code converters
Csl 202, code convertersCsl 202, code converters
Csl 202, code convertersCKSunith1
 
How to create SystemVerilog verification environment?
How to create SystemVerilog verification environment?How to create SystemVerilog verification environment?
How to create SystemVerilog verification environment?Sameh El-Ashry
 
Delays in verilog
Delays in verilogDelays in verilog
Delays in verilogJITU MISTRY
 
Vlsi physical design-notes
Vlsi physical design-notesVlsi physical design-notes
Vlsi physical design-notesDr.YNM
 
VHdl lab report
VHdl lab reportVHdl lab report
VHdl lab reportJinesh Kb
 
Lecture 2 verilog
Lecture 2   verilogLecture 2   verilog
Lecture 2 verilogvenravi10
 
Session 6 sv_randomization
Session 6 sv_randomizationSession 6 sv_randomization
Session 6 sv_randomizationNirav Desai
 
Digital Alarm Clock (IC-TMS-8560)
Digital Alarm Clock (IC-TMS-8560)Digital Alarm Clock (IC-TMS-8560)
Digital Alarm Clock (IC-TMS-8560)Chintan Patel
 
Complex Programmable Logic Device (CPLD) Architecture and Its Applications
Complex Programmable Logic Device (CPLD) Architecture and Its ApplicationsComplex Programmable Logic Device (CPLD) Architecture and Its Applications
Complex Programmable Logic Device (CPLD) Architecture and Its Applicationselprocus
 
Data flow model -Lecture-4
Data flow model -Lecture-4Data flow model -Lecture-4
Data flow model -Lecture-4Dr.YNM
 
Programmable Logic Devices
Programmable Logic DevicesProgrammable Logic Devices
Programmable Logic DevicesMadhusudan Donga
 
Synchronous and asynchronous reset
Synchronous and asynchronous resetSynchronous and asynchronous reset
Synchronous and asynchronous resetNallapati Anindra
 
8051 microcontroller lecture ppt by Tarun Khaneja ( 9034406598 )
8051 microcontroller lecture ppt by Tarun Khaneja ( 9034406598 )8051 microcontroller lecture ppt by Tarun Khaneja ( 9034406598 )
8051 microcontroller lecture ppt by Tarun Khaneja ( 9034406598 )Tarun Khaneja
 
8257 DMA Controller
8257 DMA Controller8257 DMA Controller
8257 DMA ControllerShivamSood22
 

What's hot (20)

Csl 202, code converters
Csl 202, code convertersCsl 202, code converters
Csl 202, code converters
 
How to create SystemVerilog verification environment?
How to create SystemVerilog verification environment?How to create SystemVerilog verification environment?
How to create SystemVerilog verification environment?
 
Delays in verilog
Delays in verilogDelays in verilog
Delays in verilog
 
8051 Presentation
8051 Presentation8051 Presentation
8051 Presentation
 
Vlsi physical design-notes
Vlsi physical design-notesVlsi physical design-notes
Vlsi physical design-notes
 
VHdl lab report
VHdl lab reportVHdl lab report
VHdl lab report
 
Verilog HDL
Verilog HDLVerilog HDL
Verilog HDL
 
Lecture 2 verilog
Lecture 2   verilogLecture 2   verilog
Lecture 2 verilog
 
Session 6 sv_randomization
Session 6 sv_randomizationSession 6 sv_randomization
Session 6 sv_randomization
 
Verilog hdl
Verilog hdlVerilog hdl
Verilog hdl
 
Digital Alarm Clock (IC-TMS-8560)
Digital Alarm Clock (IC-TMS-8560)Digital Alarm Clock (IC-TMS-8560)
Digital Alarm Clock (IC-TMS-8560)
 
Complex Programmable Logic Device (CPLD) Architecture and Its Applications
Complex Programmable Logic Device (CPLD) Architecture and Its ApplicationsComplex Programmable Logic Device (CPLD) Architecture and Its Applications
Complex Programmable Logic Device (CPLD) Architecture and Its Applications
 
Data flow model -Lecture-4
Data flow model -Lecture-4Data flow model -Lecture-4
Data flow model -Lecture-4
 
Programmable Logic Devices
Programmable Logic DevicesProgrammable Logic Devices
Programmable Logic Devices
 
Synchronous and asynchronous reset
Synchronous and asynchronous resetSynchronous and asynchronous reset
Synchronous and asynchronous reset
 
8051 microcontroller lecture ppt by Tarun Khaneja ( 9034406598 )
8051 microcontroller lecture ppt by Tarun Khaneja ( 9034406598 )8051 microcontroller lecture ppt by Tarun Khaneja ( 9034406598 )
8051 microcontroller lecture ppt by Tarun Khaneja ( 9034406598 )
 
Verilog hdl
Verilog hdlVerilog hdl
Verilog hdl
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
 
8257 DMA Controller
8257 DMA Controller8257 DMA Controller
8257 DMA Controller
 
Crash course in verilog
Crash course in verilogCrash course in verilog
Crash course in verilog
 

Similar to To designing counters using verilog code

Sine Wave Generator with controllable frequency displayed on a seven segment ...
Sine Wave Generator with controllable frequency displayed on a seven segment ...Sine Wave Generator with controllable frequency displayed on a seven segment ...
Sine Wave Generator with controllable frequency displayed on a seven segment ...Karthik Rathinavel
 
Digital Voltmeter displaying voltage level on a seven segment display and com...
Digital Voltmeter displaying voltage level on a seven segment display and com...Digital Voltmeter displaying voltage level on a seven segment display and com...
Digital Voltmeter displaying voltage level on a seven segment display and com...Karthik Rathinavel
 
Day4 順序控制的循序邏輯實現
Day4 順序控制的循序邏輯實現Day4 順序控制的循序邏輯實現
Day4 順序控制的循序邏輯實現Ron Liu
 
VLSI Sequential Circuits II
VLSI Sequential Circuits IIVLSI Sequential Circuits II
VLSI Sequential Circuits IIGouthaman V
 
Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014Béo Tú
 
Digital System Design-Synchronous Sequential Circuits
Digital System Design-Synchronous Sequential CircuitsDigital System Design-Synchronous Sequential Circuits
Digital System Design-Synchronous Sequential CircuitsIndira Priyadarshini
 
HDL PROGRAMMING-3.pdf
HDL PROGRAMMING-3.pdfHDL PROGRAMMING-3.pdf
HDL PROGRAMMING-3.pdfkaarthikK6
 
Blood pressure set programming
Blood pressure set programmingBlood pressure set programming
Blood pressure set programmingNoorshahida Kassim
 
Introduction to Verilog & code coverage
Introduction to Verilog & code coverageIntroduction to Verilog & code coverage
Introduction to Verilog & code coverageJyun-Kai Hu
 
5 c control statements looping
5  c control statements looping5  c control statements looping
5 c control statements loopingMomenMostafa
 
7segment scetch
7segment scetch7segment scetch
7segment scetchBang Igo
 

Similar to To designing counters using verilog code (20)

Sine Wave Generator with controllable frequency displayed on a seven segment ...
Sine Wave Generator with controllable frequency displayed on a seven segment ...Sine Wave Generator with controllable frequency displayed on a seven segment ...
Sine Wave Generator with controllable frequency displayed on a seven segment ...
 
Digital Voltmeter displaying voltage level on a seven segment display and com...
Digital Voltmeter displaying voltage level on a seven segment display and com...Digital Voltmeter displaying voltage level on a seven segment display and com...
Digital Voltmeter displaying voltage level on a seven segment display and com...
 
Verilog_Examples (1).pdf
Verilog_Examples (1).pdfVerilog_Examples (1).pdf
Verilog_Examples (1).pdf
 
Day4 順序控制的循序邏輯實現
Day4 順序控制的循序邏輯實現Day4 順序控制的循序邏輯實現
Day4 順序控制的循序邏輯實現
 
Verilog code
Verilog codeVerilog code
Verilog code
 
FPGA Tutorial - LCD Interface
FPGA Tutorial - LCD InterfaceFPGA Tutorial - LCD Interface
FPGA Tutorial - LCD Interface
 
Loops
LoopsLoops
Loops
 
VLSI Sequential Circuits II
VLSI Sequential Circuits IIVLSI Sequential Circuits II
VLSI Sequential Circuits II
 
Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014
 
Ch4
Ch4Ch4
Ch4
 
Digital System Design-Synchronous Sequential Circuits
Digital System Design-Synchronous Sequential CircuitsDigital System Design-Synchronous Sequential Circuits
Digital System Design-Synchronous Sequential Circuits
 
HDL PROGRAMMING-3.pdf
HDL PROGRAMMING-3.pdfHDL PROGRAMMING-3.pdf
HDL PROGRAMMING-3.pdf
 
VERILOG CODE
VERILOG CODEVERILOG CODE
VERILOG CODE
 
Module nco rtl
Module nco rtlModule nco rtl
Module nco rtl
 
Blood pressure set programming
Blood pressure set programmingBlood pressure set programming
Blood pressure set programming
 
Introduction to Verilog & code coverage
Introduction to Verilog & code coverageIntroduction to Verilog & code coverage
Introduction to Verilog & code coverage
 
5 c control statements looping
5  c control statements looping5  c control statements looping
5 c control statements looping
 
Cs1123 6 loops
Cs1123 6 loopsCs1123 6 loops
Cs1123 6 loops
 
7segment scetch
7segment scetch7segment scetch
7segment scetch
 
Direct analog
Direct analogDirect analog
Direct analog
 

More from Bharti Airtel Ltd.

C bjt-biasing-and-stabilization
C bjt-biasing-and-stabilizationC bjt-biasing-and-stabilization
C bjt-biasing-and-stabilizationBharti Airtel Ltd.
 
Mcq4 ac-operational-amplifiers
Mcq4 ac-operational-amplifiersMcq4 ac-operational-amplifiers
Mcq4 ac-operational-amplifiersBharti Airtel Ltd.
 
C bjt-biasing-and-stabilization
C bjt-biasing-and-stabilizationC bjt-biasing-and-stabilization
C bjt-biasing-and-stabilizationBharti Airtel Ltd.
 
A bjt-operating-modes-configurations
A bjt-operating-modes-configurationsA bjt-operating-modes-configurations
A bjt-operating-modes-configurationsBharti Airtel Ltd.
 
Noise detection from the signal matlab code, Signal Diagnosis
Noise detection from the signal matlab code, Signal Diagnosis Noise detection from the signal matlab code, Signal Diagnosis
Noise detection from the signal matlab code, Signal Diagnosis Bharti Airtel Ltd.
 
Sequence detector Verilog Code
Sequence detector Verilog CodeSequence detector Verilog Code
Sequence detector Verilog CodeBharti Airtel Ltd.
 
Verilog VHDL code Multiplexer and De Multiplexer
Verilog VHDL code Multiplexer and De Multiplexer Verilog VHDL code Multiplexer and De Multiplexer
Verilog VHDL code Multiplexer and De Multiplexer Bharti Airtel Ltd.
 
Verilog VHDL code Decoder and Encoder
Verilog VHDL code Decoder and EncoderVerilog VHDL code Decoder and Encoder
Verilog VHDL code Decoder and EncoderBharti Airtel Ltd.
 

More from Bharti Airtel Ltd. (20)

Resume Shyamveer
Resume ShyamveerResume Shyamveer
Resume Shyamveer
 
BHEL Final Report
BHEL Final ReportBHEL Final Report
BHEL Final Report
 
BHEL PPT
BHEL PPTBHEL PPT
BHEL PPT
 
Amplitude modulated-systmes
Amplitude modulated-systmesAmplitude modulated-systmes
Amplitude modulated-systmes
 
Amplitude modulated-systems
Amplitude modulated-systemsAmplitude modulated-systems
Amplitude modulated-systems
 
Mcq5 ac-fet-amplifiers
Mcq5 ac-fet-amplifiersMcq5 ac-fet-amplifiers
Mcq5 ac-fet-amplifiers
 
Mcq6 ac-mosfet-amplifier
Mcq6 ac-mosfet-amplifierMcq6 ac-mosfet-amplifier
Mcq6 ac-mosfet-amplifier
 
C bjt-biasing-and-stabilization
C bjt-biasing-and-stabilizationC bjt-biasing-and-stabilization
C bjt-biasing-and-stabilization
 
Mcq6 ac-mosfet-amplifier
Mcq6 ac-mosfet-amplifierMcq6 ac-mosfet-amplifier
Mcq6 ac-mosfet-amplifier
 
Mcq4 ac-operational-amplifiers
Mcq4 ac-operational-amplifiersMcq4 ac-operational-amplifiers
Mcq4 ac-operational-amplifiers
 
Logic gates-notesdc-iii
Logic gates-notesdc-iiiLogic gates-notesdc-iii
Logic gates-notesdc-iii
 
C bjt-biasing-and-stabilization
C bjt-biasing-and-stabilizationC bjt-biasing-and-stabilization
C bjt-biasing-and-stabilization
 
B bjt-characteristics
B bjt-characteristicsB bjt-characteristics
B bjt-characteristics
 
A bjt-operating-modes-configurations
A bjt-operating-modes-configurationsA bjt-operating-modes-configurations
A bjt-operating-modes-configurations
 
Resume shyam final
Resume shyam finalResume shyam final
Resume shyam final
 
Noise detection from the signal matlab code, Signal Diagnosis
Noise detection from the signal matlab code, Signal Diagnosis Noise detection from the signal matlab code, Signal Diagnosis
Noise detection from the signal matlab code, Signal Diagnosis
 
Sequence detector Verilog Code
Sequence detector Verilog CodeSequence detector Verilog Code
Sequence detector Verilog Code
 
Divine inspiration
Divine inspirationDivine inspiration
Divine inspiration
 
Verilog VHDL code Multiplexer and De Multiplexer
Verilog VHDL code Multiplexer and De Multiplexer Verilog VHDL code Multiplexer and De Multiplexer
Verilog VHDL code Multiplexer and De Multiplexer
 
Verilog VHDL code Decoder and Encoder
Verilog VHDL code Decoder and EncoderVerilog VHDL code Decoder and Encoder
Verilog VHDL code Decoder and Encoder
 

Recently uploaded

Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 

Recently uploaded (20)

Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 

To designing counters using verilog code

  • 1. Experiment No:9 Aim: To Implement counters. NAME: Shyamveer Singh SECTION: E1207 REG N0: 11205816 ROLL NO: B-54
  • 2. Truth Table: Up down counter: Up counter:
  • 3. Theory: An up counter simply counts from 0 to 9. We can use this circuit to make , This circuit can also be used to make a digital clock. Both Synchronous and Asynchronous counters are capable of counting “Up” or counting “Down”, but their is another more “Universal” type of counter that can count in both directions either Up or Down depending on the state of their input control pin and these are known as Bidirectional Counters. Bidirectional counters, also known as a up down counter. PROGRAMME CODES 4bit up counter: module fbuc(clk,reset,q); input clk,reset; output [3:0]q; reg [3:0]q; always@(clk) begin if(reset) q=0; else if(reset==0&&q<15) q=q+1; end endmodule
  • 4. reset = 1;clk = 0; // Wait 100 ns for global reset to finish #10; reset = 0;clk = 1; #10; reset = 0;clk = 0; #10; reset = 0;clk = 1; #10; reset = 0;clk = 0; #10; reset = 0;clk = 1; #10; reset = 0;clk = 0; #10; reset = 0;clk = 1; #10; reset = 0;clk = 0; #10; reset = 0;clk = 1; #10; reset = 0;clk = 0; #10; reset = 0;clk = 1;
  • 5. #10; reset = 0;clk = 0; #10; reset = 0;clk = 1; #10; reset = 0;clk = 0; #10; reset = 0;clk = 1; #10; // Add stimulus here end endmodule // Initialize Inputs reset = 1;clk = 0; // Wait 100 ns for global reset to finish #10; reset = 0;clk = 1; #10; reset = 0;clk = 0; #10; reset = 0;clk = 1; #10;
  • 6. reset = 0;clk = 0; #10; reset = 0;clk = 1; #10; reset = 0;clk = 0; #10; reset = 0;clk = 1; #10; reset = 0;clk = 0; #10; reset = 0;clk = 1; #10; reset = 0;clk = 0; #10; reset = 0;clk = 1; #10; reset = 0;clk = 0; #10; reset = 0;clk = 1; #10; reset = 0;clk = 0; #10; reset = 0;clk = 1; #10; // Add stimulus here end endmodule 4bit down counter module fbdc(clk,reset,q); input clk,reset; output [3:0]q; reg [3:0]q; always@(clk) begin if(reset) q=15; else if(reset==0&&q>0) q=q-1; end
  • 8. reset = 1;clk = 0; // Wait 100 ns for global reset to finish #10; reset = 0;clk = 1; #10; reset = 0;clk = 0; #10; reset = 0;clk = 1; #10; reset = 0;clk = 0; #10; reset = 0;clk = 1; #10; reset = 0;clk = 0; #10; reset = 0;clk = 1; #10; reset = 0;clk = 0; #10; reset = 0;clk = 1; #10; reset = 0;clk = 0;
  • 9. #10; reset = 0;clk = 1; #10; reset = 0;clk = 0; #10; reset = 0;clk = 1; #10; reset = 0;clk = 0; #10; reset = 0;clk = 1; #10; reset = 0;clk = 0; #10; reset = 0;clk = 1; #10; // Add stimulus here end endmodule
  • 10. 4b Up down counter module fbudc(clk,reset,up,dn,q); input clk,up,dn,reset; output [3:0]q; reg [3:0]q; always@(clk) begin if (reset) q=0; else if(up) q=q+1; else if(dn) q=q-1; end endmodule
  • 11. clk = 0; reset = 1; up = 1; dn = 0; // Wait 100 ns for global reset to finish #10; clk = 1; reset = 0; up = 1; dn = 0; #10; clk = 0; reset = 0; up = 1; dn = 0; #10; clk = 1; reset = 0; up = 1; dn = 0; #10; clk = 0;
  • 12. reset = 0; up = 1; dn = 0; #10; clk = 1; reset = 0; up = 1; dn = 0; #10; clk = 0; reset = 0; up = 1; dn = 0; #10; clk = 1; reset = 0; up = 1; dn = 0; #10; clk = 0; reset = 0; up = 1; dn = 0; #10; clk = 1; reset = 0; up = 1; dn = 0; #10; clk = 0; reset = 0; up = 1; dn = 0; #10; clk = 1; reset = 0; up = 1; dn = 0; #10; clk = 0; reset = 0; up = 1; dn = 0; #10; clk = 1; reset = 0; up = 1; dn = 0; #10;
  • 13. clk = 0; reset = 0; up = 1; dn = 0; #10; clk = 1; reset = 0; up = 1; dn = 0; #10; clk = 1; reset = 0; up = 0; dn = 1; #10; clk = 0; reset = 0; up = 0; dn = 1; #10; clk = 1; reset = 0; up = 0; dn = 1; #10; clk = 0; reset = 0; up = 0; dn = 1; #10; clk = 1; reset = 0; up = 0; dn = 1; #10; clk = 0; reset = 0; up = 0; dn = 1; #10; clk = 1; reset = 0; up = 0; dn = 1; #10; clk = 0; reset = 0; up = 0; dn = 1;
  • 14. #10; clk = 1; reset = 0; up = 0; dn = 1; #10; clk = 0; reset = 0; up = 0; dn = 1; #10; clk = 1; reset = 0; up = 0; dn = 1; #10; clk = 0; reset = 0; up = 0; dn = 1; #10; clk = 1; reset = 0; up = 0; dn = 1; #10; clk = 0; reset = 0; up = 0; dn = 1; #10; clk = 1; reset = 0; up = 0; dn = 1; #10; clk = 0; reset = 0; up = 0; dn = 1; #10; // Add stimulus here end endmodule