Lab report 4-124
docx
keyboard_arrow_up
School
San Jose State University *
*We aren’t endorsed by this school
Course
124
Subject
Electrical Engineering
Date
Apr 3, 2024
Type
docx
Pages
2
Uploaded by ElderLlamaPerson396
Lab 4: 4-bit Counter
I.
INTRODUCTION
This lab involves creating a 4-bit counter in RTL Verilog, incorporating a 4-bit Ripple Carry Adder, four 2-to-1 Multiplexers, and four D-type flip-flops. The counter, with active-low reset, exhibits forward counting (0000 to 1111) when Reset is 1 and Count is 1. When Reset is 1 and Count is 0, the counter stalls, requiring observation of transitions between logic 0 and 1 for Count to
validate the circuit. This exercise offers practical experience in RTL Verilog for digital circuit design, emphasizing comprehensive testing for circuit validation.
II.
LOGIC CIRCUIT
Fig 1. Logic Circuit Diagram for 4-bit counter
Figure 1 shows the logic circuit diagram for a 4-bit counter which has four 2:1 MUXes
and four D-type flip flops.
III.
TRUTH TABLE
Reset
Clock
Count
Q3
Q2
Q1
Q0
0
X
X
0
0
0
0
1
^
X
0
0
0
1
1
^
X
0
0
1
0
1
^
X
0
0
1
1
1
^
X
1
1
1
0
1
^
X
1
1
1
1
0
X
X
0
0
0
0
1
^
0
0
0
0
0
1
^
1
0
0
0
1
Fig 2. Logic Circuit Diagram for 4-Bit Counter
Figure 2 is the truth table for a 4- bit counter. The prompt can be generated by listing all possible combinations of inputs (Reset, Clock, and Count) and the corresponding outputs (Q3, Q2, Q1, Q0). “X”
represents don’t care case here and “^” indicates a rising edge of the clock signal.
IV.
CODE
Fig 3. Verilog code for 4- Bit Counter (Part-1)
Fig 4. Verilog code for 4- Bit Counter (Part-2)
Fig 5. Verilog code for 4- Bit Counter (Part-3)
Figure 3, figure 4 and figure 5 represents the code for the 4-bit counter. This Verilog code defines a 4-bit counter with a ripple carry adder (RCA), 2-1 MUXes, and D-type flip-flops. The counter increments on each rising edge of the clock when the count input is asserted (Count = 1). It resets to zero when the active-low reset (rst_n) is low. When Count is de-asserted (Count = 0), the counter stalls, holding its current state. The code ensures the desired forward counting behavior
and includes provisions for active-low reset and count control.
V. SIMULATION WAVEFORMS
Fig 6. 4-Bit Counter Simulation Waveforms (Part-1)
Fig 7. 4-Bit Counter Simulation Waveforms (Part-2)
Figure 6 and Figure 7 shows the Simulation waveform for 4-bit counter. The waveform also matches with the Truth Table and the Logic Circuit Diagram. When simulating the Verilog code, we observe a sequence of counter increments when Count is 1 and stalling when Count is 0. Resetting the counter should set it to 0000, and transitions of the Reset signal should control the reset behavior. The clock signal drives the counter updates.
VI. CONCLUSION
In conclusion, the provided Verilog code successfully implements a 4-bit counter using a combination of a ripple carry adder, 2-1 MUXes, and D-type flip-flops. The counter exhibits expected behavior, incrementing on clock edges when the count input is high and resetting to zero on an active-low reset signal.
The code allows for thorough verification of the counter's functionality, including forward counting and the ability to stall when the count input is low. The modular structure enhances readability and facilitates customization for specific applications.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Documents
Related Questions
What are the values of the inputs a, b, c, d, e, f and g for a Seven-Segment LED that
displays the number 2? Assume active high logic.
a) 1101101
b) 1010101
c) 1101110
d) None of the above
e) All of the above
arrow_forward
Using a MINIMUM number of Symbolic Logic gates and IC chips make the following set of circuits in this pattern:
Gated SR Latch
3 inputs NAND Symbolic NAND IC
Output Output
S'R' Latch (BE CAREFUL OF INITIAL CONDITIONS -- SEE WHICH CAUSES RACE CONDITION!)
2 inputs NAND Symbolic NAND IC
Output Output
Gated D Latch
2 inputs Inverter, NAND Symbolic NAND Symbolic NAND IC
Output Output Output
The details...
INTERACTIVE INPUT:Use only the number of Interactive Input buttons specified and put them at the far left. EVERY CIRCUIT to the right of the buttons will use these for input.
NAND Symbolic Circuit:Using only the symbolic NAND gates…
arrow_forward
7) The following figure shows a transistor-level (CMOS) circuit for some logic gate.
Sketch the logic gate for the CMOS gate.
Choices:
a) NAND gate
b) AND gate
c) OR gate
d) NOR gate
arrow_forward
Q1.
(a) Design a stick (layout) diagram for the following static CMOS logic gate,
where A, B, C, D are the logic gate inputs and O/P is the output:
VDD
D-d[Q8
A-Q5 B-Q6
c-d[Q7
O/P
CQ3 DQ4
B-Q2
A-Q1
Vss
Figure 1
Use dual-well, CMOS technology. Include wells, well-taps, contact cuts,
routing of power and GND in your diagram. Use colour coding and/or clear
and readable detailed annotations to represent the wires in the different
layers.
arrow_forward
By using the information given in image below design a BCD Counter. You have to provide all the necessary information needed to design this circuit.
arrow_forward
With brief explaination
arrow_forward
V dd
Q1
Q2
Q5
Q3
A
-Output
Q4
Q6
Write down the truth table for above logic gate with the ON / OFF status of each MOSFET and identify
the gate.
arrow_forward
Hi. Please may you give the solution to this question in a step by step form to help my understanding.
Both parts need to be completed in order to answer
arrow_forward
Exclusive OR (XOR) and Exclusive NOR (XNOR) gates can be used
a. as parity generators
b. as parity checkers
c. as comparators
d. as controlled inverters
e. as all of the given answers
arrow_forward
What will be the boolean function (y) for the given CMOS logic circuit
as shown in the figure?
AMP, MP₂-B
MP3
A—IL MN,
BCMN₂
D-
V₂
HCMN₂
DD
MP
-D
MP-E
y
MN3C
GND
MNE
arrow_forward
Determine the Q and Q' output waveforms of the D flip-flop with D and CLK inputs are given
in figure (5). Assume that negative edge triggered flip-flop is initially RESET.
E,
CLK
D.
0.
5.
arrow_forward
Consider the sequential circuit shown,
consisting of a 4 bit binary up counter, logic gates, and
output F. Assume counting starts from 0. Q3 is MSB
and Q0 is LSB.
(a) Draw a Moore state diagram for the sequential
circuit, indicating value of output F for each state.
(b) How many invalid states does the circuit have?
0
0
0-
0
4 Bit Up Counter
Load
D3
D2
D1
DO
Count
1
Q3
Q2
Q1
QO
CLK
CLK
F
arrow_forward
Can I get the written solution by hand and not ai
arrow_forward
need help with digital logic
arrow_forward
Task 1: Custom Sequence Counter
Using JK Flip Flop, Design a counter circuit that cycles through the sequence: 0, 5, 4, 6, 1, 7,
and repeats.
Follow these steps:
a) State Diagram: Draw a state diagram representing the sequence. Each state should be
expressed as a binary number.
b) State Table: Create a state table for the counter, detailing current states, next states, and
outputs.
c) Flip-Flop Input Equations: From the state table, derive the input equations for the flip-
flops. Treat any unused states as don't-care conditions.
d) Simplification using K-maps: Use Karnaugh maps to simplify the flip-flop input
equations. Optionally, verify your simplifications using Multisim.
e) Circuit Diagram: Draw the circuit diagram.
Task 2: 3-bit Up/Down Counter
Using Flip Flop of your choice, design a 3-bit counter that counts up or down based on an
input signal X. The counter should behave as follows:
Initial State: On powerup, the counter starts at 0.
Count Up (X=1): Sequence progresses through…
arrow_forward
a) Design a single-digit decade counter that counts from 0 to 9 and repeats. The single-digit decade counter
should be built by a cascaded synchronous binary counter (74LS163) and other basic logic gates. Simulate
the complete counter circuit by OrCAD and PSPICE. Capture the circuit schematic and the simulated
waveform. (Define the simulation timings for at least one full counting cycle from 0 to 9 and back to 0.)
(Hint: Use the DigClock input from the SOURCE as shown below and setup the CLK ONTIME and
OFFTIME accordingly for the clock source.)
1/6
Pat
DigClock
Part List
OFFTIME = SuS DSTM1
ONTIME =
DELAY=
STARTVAL = 0
OPPVAL = 1
Sus
EUK
FleStim
AC
Lbrajes
Design Cache
b) Read the specification of 74LS47 (BCD-to-7-Segment Decoder shown in Appendix) to see how the logic IC
operates to drive a 7-segment LED display. Draw the circuit connection of the decade counter in (a) and the
decoder to display the count value on the 7-segment LED display. Further explain why common anode…
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
![Text book image](https://www.bartleby.com/isbn_cover_images/9781133702818/9781133702818_smallCoverImage.gif)
Related Questions
- What are the values of the inputs a, b, c, d, e, f and g for a Seven-Segment LED that displays the number 2? Assume active high logic. a) 1101101 b) 1010101 c) 1101110 d) None of the above e) All of the abovearrow_forwardUsing a MINIMUM number of Symbolic Logic gates and IC chips make the following set of circuits in this pattern: Gated SR Latch 3 inputs NAND Symbolic NAND IC Output Output S'R' Latch (BE CAREFUL OF INITIAL CONDITIONS -- SEE WHICH CAUSES RACE CONDITION!) 2 inputs NAND Symbolic NAND IC Output Output Gated D Latch 2 inputs Inverter, NAND Symbolic NAND Symbolic NAND IC Output Output Output The details... INTERACTIVE INPUT:Use only the number of Interactive Input buttons specified and put them at the far left. EVERY CIRCUIT to the right of the buttons will use these for input. NAND Symbolic Circuit:Using only the symbolic NAND gates…arrow_forward7) The following figure shows a transistor-level (CMOS) circuit for some logic gate. Sketch the logic gate for the CMOS gate. Choices: a) NAND gate b) AND gate c) OR gate d) NOR gatearrow_forward
- Q1. (a) Design a stick (layout) diagram for the following static CMOS logic gate, where A, B, C, D are the logic gate inputs and O/P is the output: VDD D-d[Q8 A-Q5 B-Q6 c-d[Q7 O/P CQ3 DQ4 B-Q2 A-Q1 Vss Figure 1 Use dual-well, CMOS technology. Include wells, well-taps, contact cuts, routing of power and GND in your diagram. Use colour coding and/or clear and readable detailed annotations to represent the wires in the different layers.arrow_forwardBy using the information given in image below design a BCD Counter. You have to provide all the necessary information needed to design this circuit.arrow_forwardWith brief explainationarrow_forward
- V dd Q1 Q2 Q5 Q3 A -Output Q4 Q6 Write down the truth table for above logic gate with the ON / OFF status of each MOSFET and identify the gate.arrow_forwardHi. Please may you give the solution to this question in a step by step form to help my understanding. Both parts need to be completed in order to answerarrow_forwardExclusive OR (XOR) and Exclusive NOR (XNOR) gates can be used a. as parity generators b. as parity checkers c. as comparators d. as controlled inverters e. as all of the given answersarrow_forward
- What will be the boolean function (y) for the given CMOS logic circuit as shown in the figure? AMP, MP₂-B MP3 A—IL MN, BCMN₂ D- V₂ HCMN₂ DD MP -D MP-E y MN3C GND MNEarrow_forwardDetermine the Q and Q' output waveforms of the D flip-flop with D and CLK inputs are given in figure (5). Assume that negative edge triggered flip-flop is initially RESET. E, CLK D. 0. 5.arrow_forwardConsider the sequential circuit shown, consisting of a 4 bit binary up counter, logic gates, and output F. Assume counting starts from 0. Q3 is MSB and Q0 is LSB. (a) Draw a Moore state diagram for the sequential circuit, indicating value of output F for each state. (b) How many invalid states does the circuit have? 0 0 0- 0 4 Bit Up Counter Load D3 D2 D1 DO Count 1 Q3 Q2 Q1 QO CLK CLK Farrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
![Text book image](https://www.bartleby.com/isbn_cover_images/9781133702818/9781133702818_smallCoverImage.gif)