-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathup_down_button.v
69 lines (62 loc) · 1.48 KB
/
up_down_button.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
67
68
69
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 15:03:55 03/18/2017
// Design Name:
// Module Name: up_down_button
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module up_down_button(
input btn5,
input switchLSB,
input switchMSB,
input switch_u_d,
output [1:0] up_or_down,
output [1:0] actualStage
);
reg reg_btn5;
reg reg_switch;
reg reg_switchLSB;
reg reg_switchMSB;
reg [1:0] reg_out;
reg [1:0] reg_actual_stage;
always@(*)begin
reg_btn5 = btn5;
reg_switch = switch_u_d;
reg_switchLSB = switchLSB;
reg_switchMSB = switchMSB;
if ((reg_btn5 == 1) & (reg_switch == 1)) //Condicion para subir 11
begin
reg_actual_stage[1] = reg_switchMSB;///////
reg_actual_stage[0] = reg_switchLSB;
reg_out[1] = 1;
reg_out[0] = 1;
end
else if ((reg_btn5 == 1) & (reg_switch == 0))//Condicion para bajar 10
begin
reg_actual_stage[1] = reg_switchMSB;///////
reg_actual_stage[0] = reg_switchLSB;
reg_out[1] = 1;
reg_out[0] = 0;
end
else
begin // Permanece donde esta 00
reg_out[1] = 0;
reg_out[0] = 0;
end
end
assign up_or_down = reg_out;
assign actualStage = reg_actual_stage;
endmodule