Professional Documents
Culture Documents
COIMBATORE – 641004
SUBMITTED BY:
KUMBESH BABU B(22E130)
MADHUMITHA K M (22E131)
MEHALAN M(22E132)
MOHAMMED AATHISH N Y (22E133)
MONISH KUMAR S (22E134) SUBMITTED TO:
NANDINI S (22E135) DR.A.NATARAJAN,
NIRAIMATHI T(22E136) PROFESSOR,
NISHANTHINI C(22E137) DEPARTMENT OF EEE
1
TOPIC PAGE NO
SNO
1 AIM 3
2 APPARATUS REQUIRED 3
3 THEORY 3-4
5 OUTPUT 6
8 RESULT 14
TABLE OF CONTENT
2
DESIGN AND SIMULATION OF SIMPLE SEQUENTIAL CIRCUIT USING
VERILOG
AIM
To design and simulation of simple sequential circuits (up down
counter) – 4 bit.
APPARATUS REQUIRED
Vivado 16.2
THEORY
Counter
A Counter is a device which stores (and sometimes displays) the
number of times a particular event or process has occurred, often in
relationship to a clock signal.
Counters are used in digital electronics for counting purpose, they
can count specific event happening in the circuit.
For example, in UP counter a counter increases count for every rising
edge of clock. Not only counting, a counter can follow the certain sequence
based on our design like any random sequence 0,1,3,2….
They can also be designed with the help of flip flops. They are used
as frequency dividers where the frequency of given pulse waveform is
divided.
Counters are sequential circuit that count the number of pulses can
be either in binary code or BCD form.
The main properties of a counter are timing, sequencing, and
counting.
Counters are broadly divided into two categories
Asynchronous counter
Synchronous counter
3
4 bit up/down counter
The up/Down counter is also known as the bidirectional counter
which is used to count in any direction based on the condition of the input
control pin. These are used in different applications to count up from zero
to provide a change within the output condition on attaining a fixed value &
others count down from a fixed value to zero to give an output condition
change. There are some types of counters like TTL 74LS190 & 75LS191
which can function in both up & down count mode based on the condition
of an input pin of up/down count mode.
VERILOG CODE
module upordown_counter(
Clk,
reset,
UpOrDown, //high for UP counter and low for Down counter
Count
4
);
//input ports and their sizes
input Clk,reset,UpOrDown;
//output ports and their size
output [3 : 0] Count;
//Internal variables
reg [3 : 0] Count = 0;
always @(posedge(Clk) or posedge(reset))
begin
if(reset == 1)
Count <= 0;
else
if(UpOrDown == 1) //Up mode selected
if(Count == 15)
Count <= 0;
else
Count <= Count + 1; //Incremend Counter
else //Down mode selected
if(Count == 0)
Count <= 15;
else
Count <= Count - 1; //Decrement counter
end
endmodule
5
OUTPUT:
Down counter:
UP COUNTER:
6
PRE LAB QUESTIONS
Sequential circuits are digital circuits that store and use the previous state
information to determine their next state. Unlike combinational circuits,
which only depend on the current input values to produce outputs,
sequential circuits depend on both the current inputs and the previous state
stored in memory elements.
7
3.What are the different types of flip flop?
3. T Flip Flop
4. D Flip Flop
8
When edge triggering is used, the
output signal is activated when the
In level triggering, the output
trigger edge is detected and
signal will remain in the triggered
changes to the opposing state. As
condition.
long as the input signal is at or
above the trigger level.
POST LAB
9
STATEMENT
Represented using “=” operator sign Represented using “<=” operator sign
between LHS & RHS between LHS & RHS
Blocking assignments used to Non Blocking assignments are used
represent Combinational logic to represent Sequential logic
Blocking assignments can be used in Non Blocking assignment can be
procedural assignments like initial, used in procedural assignment like
always and continuous assignments to Initial, always and continuous
nets like assign statements assignments to nets like assign
statement is not permitted
module d_ff_with_reset (
);
begin
If (reset)
else
q<= d; // Update the output with the input data when clocked
end
endmodule
10
This code defines a D flip-flop with a reset input. The flip-flop’s output ‘q’
changes according to the input ‘d’ on every rising edge of the clock (clk).
When the reset signal is asserted (i.e., goes high), the output ‘q’ is reset to
0, regardless of the clock state.
11
Timing verification is the process of ensuring that a digital design
meets specific timing requirements or constraints.
In digital systems, timing is critical because signals must propagate
through various logic elements within specified time limits to ensure
correct operation.
Timing verification involves analyzing and verifying that the design
meets these timing requirements.
Key aspects of timing verification include:
1.Setup Time and Hold Time: Ensuring that inputs to flip-flops meet
setup and hold time requirements, meaning the inputs must be stable for
a certain time period before and after the clock edge.
2.Clock Frequency: Verifying that the design can operate at the desired
clock frequency without violating timing constraints, such as maximum
clock-to-output delay.
5.Data Path Timing: Verifying timing constraints for critical paths in the
data path, ensuring that data can be processed within the required time.
5.Write HDL code for 4 bit ripple counter using t flip flop assume it
has propagation delay of 1 Unit time.
12
module ripple_counter (
);
begin
If (reset)
else
end
begin
q <= next_q;
end
endmodule
This code implements a 4-bit ripple counter using T flip-flops. The counter
increments on every rising edge of the clock (clk).
13
The toggle input of each T flip-flop is connected to the output of the
previous flip-flop, creating a ripple effect. The reset input resets the counter
to zero when asserted
RESULT
14