This repository has been archived by the owner on May 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbarModule.v
144 lines (121 loc) · 2.73 KB
/
barModule.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
`timescale 1ns / 1ps
module Barras(
input[1:0] stage_number,
output[9:0] bar1_h_m,
output[9:0] bar1_h_e,
output[9:0] bar1_v_m,
output[9:0] bar1_v_e,
output[9:0] bar2_h_m,
output[9:0] bar2_h_e,
output[9:0] bar2_v_m,
output[9:0] bar2_v_e,
output[9:0] bar3_h_m,
output[9:0] bar3_h_e,
output[9:0] bar3_v_m,
output[9:0] bar3_v_e,
output[9:0] bar4_h_m,
output[9:0] bar4_h_e,
output[9:0] bar4_v_m,
output[9:0] bar4_v_e
);
assign bar1_h_m = bar1_r[0];
assign bar1_h_e = bar1_r[1];
assign bar1_v_m = bar1_r[2];
assign bar1_v_e = bar1_r[3];
assign bar2_h_m = bar2_r[0];
assign bar2_h_e = bar2_r[1];
assign bar2_v_m = bar2_r[2];
assign bar2_v_e = bar2_r[3];
assign bar3_h_m = bar3_r[0];
assign bar3_h_e = bar3_r[1];
assign bar3_v_m = bar3_r[2];
assign bar3_v_e = bar3_r[3];
assign bar4_h_m = bar4_r[0];
assign bar4_h_e = bar4_r[1];
assign bar4_v_m = bar4_r[2];
assign bar4_v_e = bar4_r[3];
reg[9:0] bar1_r[3:0];
reg[9:0] bar2_r[3:0];
reg[9:0] bar3_r[3:0];
reg[9:0] bar4_r[3:0];
always@(stage_number)
begin
case(stage_number)
2'd0:
begin
bar1_r[0] = 9'd100;
bar1_r[1] = 9'd250;
bar1_r[2] = 9'd350;
bar1_r[3] = 9'd375;
bar2_r[0] = 9'd350;
bar2_r[1] = 9'd500;
bar2_r[2] = 9'd350;
bar2_r[3] = 9'd375;
bar3_r[0] = 9'd10;
bar3_r[1] = 9'd40;
bar3_r[2] = 9'd170;
bar3_r[3] = 9'd195;
bar4_r[0] = 9'd250;
bar4_r[1] = 9'd300;
bar4_r[2] = 9'd70;
bar4_r[3] = 9'd95;
end
2'd1:
begin
bar1_r[0] = 9'd0;
bar1_r[1] = 9'd130;
bar1_r[2] = 9'd360;
bar1_r[3] = 9'd480;
bar2_r[0] = 9'd160;
bar2_r[1] = 9'd290;
bar2_r[2] = 9'd240;
bar2_r[3] = 9'd360;
bar3_r[0] = 9'd320;
bar3_r[1] = 9'd450;
bar3_r[2] = 9'd120;
bar3_r[3] = 9'd240;
bar4_r[0] = 9'd480;
bar4_r[1] = 9'd610;
bar4_r[2] = 9'd0;
bar4_r[3] = 9'd120;
end
2'd2:
begin
bar1_r[0] = 9'd0;
bar1_r[1] = 9'd150;
bar1_r[2] = 9'd190;
bar1_r[3] = 9'd450;
bar2_r[0] = 9'd150;
bar2_r[1] = 9'd250;
bar2_r[2] = 9'd260;
bar2_r[3] = 9'd450;
bar3_r[0] = 9'd250;
bar3_r[1] = 9'd470;
bar3_r[2] = 9'd350;
bar3_r[3] = 9'd450;
bar4_r[0] = 9'd460;
bar4_r[1] = 9'd520;
bar4_r[2] = 9'd300;
bar4_r[3] = 9'd450;
end
default:begin
bar1_r[0] = 9'd0;
bar1_r[1] = 9'd150;
bar1_r[2] = 9'd190;
bar1_r[3] = 9'd450;
bar2_r[0] = 9'd150;
bar2_r[1] = 9'd250;
bar2_r[2] = 9'd260;
bar2_r[3] = 9'd450;
bar3_r[0] = 9'd250;
bar3_r[1] = 9'd470;
bar3_r[2] = 9'd350;
bar3_r[3] = 9'd450;
bar4_r[0] = 9'd460;
bar4_r[1] = 9'd500;
bar4_r[2] = 9'd290;
bar4_r[3] = 9'd450;
end
endcase
end
endmodule