This repository has been archived by the owner on Jan 31, 2024. It is now read-only.
forked from roygabriel102/GRU-LSTM-Verliog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Test.v
66 lines (50 loc) · 1.3 KB
/
Test.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//This file has not been adjusted for the GRU LSTM
`timescale 1ns / 1ps
module Test;
// Inputs
reg [15:0] c_in;
reg [15:0] h_in;
reg [15:0] X;
// Outputs
wire [15:0] c_out;
wire [15:0] h_out;
// Instantiate the Unit Under Test (UUT)
lstm_cell uut (
.c_in(c_in),
.h_in(h_in),
.X(X),
.c_out(c_out),
.h_out(h_out)
);
initial begin
// Initialize Inputs
c_in = 0;
h_in = 0;
X = 0;
// Wait 100 ns for global reset to finish
// Take not too large inputs such that they don't overflow and give proper results after right shift
// Preferably, take inputs <4 && >-4
// First 8 bits are integeral part and last 8 bits are fractional
// All Numbers are signed
#200;
X=-16'h0080; // X = -0.5
c_in=-16'h0100; // c_in = -1
h_in=16'h0280; // h_in = 2.5
$monitor("Cell State: %d, Output (After Activation):%d ",c_out,h_out);
#200;
X=16'h0110;
c_in=16'h0110;
h_in=16'h0211;
$monitor("Cell State: %d, Output (After Activation):%d ",c_out,h_out);
#200;
X=-16'h0110;
c_in=16'h0120;
h_in=16'h0011;
$monitor("Cell State: %d, Output (After Activation):%d ",c_out,h_out);
#200;
X=16'h0110;
c_in=16'h0210;
h_in=-16'h0011;
$monitor("Cell State: %d, Output (After Activation):%d ",c_out,h_out);
end
endmodule