Im building a clock using HDL system verilog and I need help implementing this instantiation method. Basically what happens is in the top module ClockCounter, positive clock edges are counted and passed into module timer using instantiation. Once the counter reaches MaxCount (59), a carry is generated which increments the minute clock. Once the minute clock reaches 59, another carry is generated which increments the hour clock. In module timer() below, I need help figuring out what variables in each ClockCounter instantiation need to be declared and what type they need to be declared as in module timer(). On a side note the clock will count in military time.
module ClockCounter(input Clk, Run, Reset, input [7:0]
MaxCount,
output [7:0]
Count, output reg Carry);
always_ff@(posedge Clk or posedge Reset)
begin
if (Reset) begin
Count <= 0;
Carry <= 0;
end
else
if (Run)
if (Count < MaxCount)
begin
Count <= Count + 8'd1;
Carry <= 0;
end
else begin
Count <= 0;
Carry <= 1;
end
end
endmodule
module timer(//variable declarartions)
ClockCounter SecClk (clk_sec, Run_t, Reset_t, fiftynine,
Seconds, Carry_scl);
ClockCounter MinClk (Carry_scl, Run_t|set_min_t, Reset_t,
fiftynine, Minutes, Carry_mcl);
ClockCounter HrClk (Carry_Mcl, Run_t,|set_hr_t, Reset_t,
twentythree, Hours, Carry_hcl);
endmodule
//I don't understand why set_min_t and set_hr_t is there , except to pause value.
//I have taken these two as ports in top module as you haven't given any information about those. If you need to change in design let me know.
module ClockCounter(input Clk, Run, Reset, input [7:0]
MaxCount,
output reg [7:0] Count, output reg Carry);
always_ff@(posedge Clk or posedge Reset) begin
if (Reset) begin
Count <= 0;
Carry <= 0;
end
else
if (Run)
if (Count < MaxCount) begin
Count <= Count + 8'd1;
Carry <= 0;
end
else begin
Count <= 0;
Carry <= 1;
end
end
endmodule
module timer(
//variable declarartions
input clk,Reset_t,Run_t,set_min_t,set_hr_t,
output [7:0]Hours,Minutes,Seconds
);
wire clk_sec,Carry_scl,Carry_mcl,Carry_hcl;
wire [7:0]fiftynine,twentythree;
assign clk_sec = clk;
// Default constant values which will be max count for hours and
minutes
assign fiftynine = 59;
assign twentythree = 23;
//Instantiation of clock counter module 3 times for hours,minutes
and seconds clock
ClockCounter SecClk (clk_sec, Run_t, Reset_t, fiftynine,
Seconds,Carry_scl);
ClockCounter MinClk (Carry_scl, (Run_t|set_min_t), Reset_t,
fiftynine, Minutes, Carry_mcl);
ClockCounter HrClk (Carry_mcl, (Run_t|set_hr_t), Reset_t,
twentythree, Hours, Carry_hcl);
endmodule
//Testbench
`timescale 1s/100ms
module test;
reg clk,Reset_t,Run_t,set_min_t,set_hr_t;
wire [7:0]Hours,Minutes,Seconds;
always begin
#5 clk = 1'b0;
#5 clk = ~clk;
end
timer
TIMER(clk,Reset_t,Run_t,set_min_t,set_hr_t,Hours,Minutes,Seconds);
initial begin
{Reset_t,Run_t,set_min_t,set_hr_t} = 'd0; //Making or initialising
all 0's
Reset_t = 1'b1;
@(posedge clk) Reset_t = 1'b0;
Run_t = 1'b1;
#1000000 $finish;
end
endmodule

Im building a clock using HDL system verilog and I need help implementing this instantiation meth...
I need help writing the Verilog Design code for this test bench. I have to calculate the dot product of two 8-bit vectors a and b. I have listed the test bench below: // Code your testbench here module test_VVM; wire [3:0] value; wire done; reg clk, rst; reg [7:0] a, b; initial begin a = 8'b11011101; b = 8'b11010111; clk = 1'd0; //at time 0 rst = 1'd0; //at time 0 rst = #2 1'd1; //at...
I need help writing a test bench for the following Verilog code module CU(IE, WE, WA, RAE, RAA, RBE, RBA, ALU, SH, OE, start, clk, reset, Ng5); //nG5 denotes (N>5); input start, clk, reset; output IE, WE, RAE, RBE, OE; output [1:0] WA, RAA, RBA, SH; output [2:0] ALU; input wire Ng5; reg [1:0] state; reg [1:0] nextstate; parameter S0 = 3'b000; parameter S1 = 3'b001;...
Need help with this java code supposed to be a military time clock, but I need help creating the driver to test and run the clock. I also need help making the clock dynamic. public class Clock { private int hr; //store hours private int min; //store minutes private int sec; //store seconds public Clock () { setTime (0, 0, 0); } public Clock (int hours, intminutes, int seconds) { setTime (hours, minutes, seconds); } public void setTime (int hours,int...
How do I change these modules so that the communication is bidirectional (inout)? I'm simply not sure how to modify the code. I know i need to add an inout port but I don't know how to do it. I have watched multiple tutorials but I can't figure it out. module mem( input logic clk, we , // write enable bit, active low input logic [n-1:0] in , input logic [m-1:0] addr , output logic [n-1:0] out ) ; parameter...
How do I change these modules so that the communication is bidirectional (inout)? I'm simply not sure how to modify the code. I know i need to add an inout port but I don't know how to do it. I have watched multiple tutorials but I can't figure it out. module mem( input logic clk, we , // write enable bit, active low input logic [n-1:0] in , input logic [m-1:0] addr , output logic [n-1:0] out ) ; parameter...
A sequential circuit has one input (X), a clock input (CLK), and
two outputs (S and V). X, S and V are all one-bit signals. X
represents a 4-bit binary number N, which is input least
significant bit first. S represents a 4-bit binary number equal to
N + 3, which is output least significant bit first. At the time the
fourth input occurs, V = 1 if N + 3 is too large to be represented
by 4 bits;...
1&2 and please I need quickly.
Q1 (35 pts): Design a combinational circuit that takes 8 bits of input and checks iif the inputs are symmetric or not and produces an output immediately. Example: 10011001 or 11000011 produce 1 and 11011010 or 11001100 produce 0.) (a) Write Verilog RTL for this circuit. (b) Same functionality but output appears next cycle. You can instantiate the design in part a. (c) Same functionality but output appeurs after two cycles. You can instantiate...
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...
Hello I need help with the following I'm having trouble getting to just the main code. Attached is the ButtonDebounce header file and the description of the code the language is C++; This lab will end with a functioning combination lock. The lock will have a combination that resides in EEPROM, and is programmable via the serial port. The user will enter a code, using the button and encoder on the board, and is shown on the lcd screen. Once...
I need help implementing 3 function prototypes with using operator overloading in a class. I have bolded the section I need help with since the cpp file is bigger than I expected. Any comments throughout would be extremely helpful. Time.cpp file #include "Time.h" #include #include #include // The class name is Time. This defines a class for keeping time in hours, minutes, and AM/PM indicator. // You should create 3 private member variables for this class. An integer variable for...