-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdownTagger.v
More file actions
64 lines (53 loc) · 2.41 KB
/
Copy pathupdownTagger.v
File metadata and controls
64 lines (53 loc) · 2.41 KB
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
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11/27/2017 04:25:13 PM
// Design Name:
// Module Name: updownTagger
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module updownTagger(
input clk, twoSec, top, bottom, up, down,
output countUp, countDown, upDownLD, activeGreen
);
wire [14:0] con;
wire [2:0] inD;
wire [2:0] outQ;
assign con[0] = 1'b0;
assign con[1] = ~twoSec & outQ[0]; //used to transition to Q0
assign con[2] = twoSec & outQ[0]; //used to transition to Q1
assign con[3] = ~bottom & ~up & outQ[1]; //used to transition to Q1
assign con[4] = bottom & down & outQ[1]; //used to transition to Q1
assign con[5] = bottom & ~down & outQ[1]; //used to transition to Q2
assign con[6] = ~bottom & up & outQ[1]; //used to transition to Q2
assign con[7] = bottom & up & outQ[1]; //used to transition to Q2
assign con[8] = ~top & ~down & outQ[2]; //used to transition to Q2
assign con[9] = top & up & outQ[2]; //used to transition to Q2
assign con[10] = top & ~up & outQ[2]; //used to transition to Q1
assign con[11] = ~top & down & outQ[2]; //used to transition to Q1
assign con[12] = top & down & outQ[2]; //used to transition to Q1
assign con[13] = up & down & outQ[1];
assign con[14] = up & down & outQ[2];
assign inD[0] = con[1];
assign inD[1] = con[2] | con[3] | con[4] | con[10] | con[11] | con[12];
assign inD[2] = con[5] | con[6] | con[7] | con[8] | con[9];
assign activeGreen = ~outQ[0];
assign upDownLD = outQ[0];
assign countUp = outQ[2] & ~con[9] & ~con[14];
assign countDown = outQ[1] & ~con[4] & ~con[13];
FDRE #(.INIT(1'b1)) ff_instance_0 (.C(clk), .CE(1'b1), .D(inD[0]), .Q(outQ[0]));
FDRE #(.INIT(1'b0)) ff_instance_1 (.C(clk), .CE(1'b1), .D(inD[1]), .Q(outQ[1]));
FDRE #(.INIT(1'b0)) ff_instance_2 (.C(clk), .CE(1'b1), .D(inD[2]), .Q(outQ[2]));
endmodule