-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrotationalPick2.sv.bak
49 lines (42 loc) · 1.33 KB
/
rotationalPick2.sv.bak
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
module rotationalPick2 ( input CLK,
input [9:0] centerX,centerY,radius, PickY,
output logic [9:0] RotX, RotY);
//the key varibale it takes which is PickY must go from 32 to 479 inclusive
logic [8:0] cosADDR;
logic [9:0] cosDATA;
logic [8:0] sinADDR;
logic [9:0] sinDATA;
//NOTE SMALL BUG WHEN ON SPECIFIC LOCATIONS OF PICK moving
TrigLUT cosmod(.address(cosADDR),.clock(CLK),.q(cosDATA));
TrigLUT sinmod(.address(sinADDR),.clock(CLK),.q(sinDATA));
assign cosADDR = (PickY-32) % 448;
assign sinADDR = ((PickY-32)+ 112) % 448;
always_comb
begin
if(32 <= PickY & PickY < 144)
begin
RotX = centerX + (radius*cosDATA)/1000; // center + r*cos
RotY = centerY + (radius*sinDATA)/1000; // center + r*sin
end
else if(144 <= PickY & PickY < 256)
begin
RotX = centerX - (radius*cosDATA)/1000; // center + r*cos
RotY = centerY + (radius*sinDATA)/1000; // center + r*sin
end
else if(256 <= PickY & PickY < 368)
begin
RotX = centerX - (radius*cosDATA)/1000; // center + r*cos
RotY = centerY - (radius*sinDATA)/1000; // center + r*sin
end
else if (368 <= PickY & PickY < 480)
begin
RotX = centerX + (radius*cosDATA)/1000; // center + r*cos
RotY = (centerY - (radius*sinDATA)/1000); // center + r*sin
end
else
begin
RotX = centerX + radius;
RotY = centerY;
end
end
endmodule