CODE:
module up_down_counter(input clk, reset,UpOrDown, output[7:0]
Count
);
reg [7 : 0] Count = 0;
always @(posedge(clk) or posedge(reset))
begin
if(reset == 1)
Count <= 0;
else
if(UpOrDown == 1) //Up mode selected
if(Count == 255)
Count <= 0;
else
Count <= Count + 1; //Incremend Counter
else //Down mode selected
if(Count == 0)
Count <= 255;
else
Count <= Count - 1; //Decrement counter
end
end module
TESTBENCH:
module tb_counter;
// Inputs
reg Clk;
reg reset;
reg UpOrDown;
// Outputs
wire [7:0] Count;
// Instantiate the Unit Under Test (UUT)
upordown_counter uut (
.Clk(Clk),
.reset(reset),
.UpOrDown(UpOrDown),
.Count(Count)
);
//Generate clock with 10 ns clk period.
initial Clk = 0;
always #5 Clk = ~Clk;
initial begin
// Apply Inputs
reset = 0;
UpOrDown = 0;
#300;
UpOrDown = 1;
#300;
reset = 1;
UpOrDown = 0;
#100;
reset = 0;
end
endmodule
Experiment #3 Design and create simulation waveform for an 8-bit up/down synchronous (rising edge of clock) binary coun...
WRITE IN SYSTEM VERILOG: Write an HDL code for a 32-bit Up-Down counter with rising edge clock, synchronous reset, and an up_down selection input. B1. Write an HDL code for a 32-bit Up-Down counter with rising edge clock, synchronous reset, and an up_down selection input. B1.
Please include waveform Experiment #1 Design and create simulation waveform for an 8-bit even parity checker using Verilog. The system will accept 8-bit data and outputs a one if there are even numbers of ones, otherwise outputs zero. (hint: xor is helpful) Exnerimont #2 Experiment #1 Design and create simulation waveform for an 8-bit even parity checker using Verilog. The system will accept 8-bit data and outputs a one if there are even numbers of ones, otherwise outputs zero. (hint:...
Experiment #4 Design and create a simulation waveform for a 5 out of 16 event detector using Verilog. This system will assert output to 1 when exactly 5 out of the last 16 serial events (value of input at the rising edges of clock) have been 1s. Here is an example timing diagram: CLK IN 1 2 3 4 6 OUT Experiment #4 Design and create a simulation waveform for a 5 out of 16 event detector using Verilog. This...
ECEN3233 Digital Logic Design Name 3. Use a synchronous 4-bit binary up counter (with load and enable) to design a modulo-8 counter (also called offset counter) that begins with 0100, which means the counting sequence is: 0100-0101-0110->0111->1000->1001->1010->1011->0100-0101... Please complete your design using the figure on the next page. Use some logic gates if you need. (10 points) Enable Load Clock
Q2) 4-bit Synchronous Counter Using Proteus, design Synchronous 4 bit Up binary counter using JK flip flops (Use 74HC76 JK flipflop). The circuit count from 0000 to 1111, etc. Experiment procedure: طريقة اجراء التجربة a) Complete the circuit. You can use external gates based on the following conditions: o Flipflop A switches every clock. o Flipflop B switches when the output of flipflop A=1 o Flipflop C switches when the outputs of A-B=1 o Flipflop D switches when the outputs of A=B=C=1 b) What is the typical feature of...
Use a behavioral Verilog model to design a 3-bit fault tolerant up-down counter. For each flip-flop (FF) include asynchronous reset and preset signals. Refer to Example 4.3 on page 160 for an example of a single FF with both reset and preset signals as well as with an enable signal. For this project, you don't need to use FFs with enables. You don't also need not-q (nq) in this assignment. Use active-high signals for reset and present signals. The example...
Consider the circuit in Figure 1. It is a 4-bit (QQ2Q3) synchronous counter which uses four T-type flip-flops. The counter increases its value on each positive edge of the clock if the Enable signal is asserted. The counter is reset to 0 by setting the Clear signal low. You are to implement an 8-bit counter of this type Enable T Q Clock Clear Figure 1. 4-bit synchronous counter (but you need to implement 8-bit counter in this lab) Specific notes:...
1) Design a synchronous 3-bit binary UP/DOWN counter uses the following counting pattern 10.2.3.7.6.40.1.3...) the counter will count in this pattern indefinitely when the input X is equal to 1. When the input the counter will reverse direction and count in the opposite pattern 0. 4 7310) Complete the state diagram, transition table, New state s and solve for the recitation equations for flipflops that will perform this function. (You do not need to draw the flip-flops Use the state...
Design (and then verify your design by simulating it) a two-bit counter that counts up or down. Use an enable input E to determine whether the counter is on or off: if E = 0 the counter is disabled and remains at its present count even if clock pulses are applied. If E = 1, the counter is enabled and a second input, x, determines the direction of the count: if x = 1 the circuit counts upward 00, 01,...
In this lab, you will design a finite state machine to control the tail lights of an unsual car. There are three lights on each side that operate in sequence to indicate thedirection of a turn. Figure ! shows the tail lights and Figure 2 shows the flashing sequence for (a) left turns and (b) right rums. ZOTTAS Figure 28:8: BCECECece BCECECECes BCECECECB BCECECBCB 8888 Figure 2 Part 1 - FSM Design Start with designing the state transition diagram for...