-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtestbench_decClkwork.v
47 lines (42 loc) · 1.35 KB
/
testbench_decClkwork.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* ------------------------------------------------ *
* Title : Decimal Clockwork Simulation *
* Project : Digital Clock *
* ------------------------------------------------ *
* File : testbench_decClkwork.v *
* Author : Yigit Suoglu *
* Last Edit : 21/04/2021 *
* ------------------------------------------------ *
* Description : Simulation decimal clockwork *
* ------------------------------------------------ */
`include "Source/clockwork.v"
`timescale 1ns / 1ps
module tb();
reg clk_clock, time_ow;
reg [19:0] time_in;
wire [19:0] time_out;
wire [6:0] sec, min;
wire [5:0] hour;
always #5 clk_clock = ~clk_clock; //In sim we assume 10ns = 1s
assign {hour, min, sec} = time_out;
clockWorkDec uut(clk_clock, time_in, time_out, time_ow);
initial
begin
clk_clock = 0;
time_ow = 0;
time_in = {6'h23,7'h48,7'h0}; //23:48:00
#12
time_ow = 1;
#10
time_ow = 0;
#1000000
$finish;
end
initial //to get simulation outputs
begin
$dumpfile("output_waveform.vcd");
$dumpvars(0, clk_clock);
$dumpvars(1, hour);
$dumpvars(2, min);
$dumpvars(3, sec);
end
endmodule