-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsinCos.sv
109 lines (100 loc) · 3.61 KB
/
sinCos.sv
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
module sinCos(input[5:0] AngleI,
output[7:0] sin, cos);
logic [7:0] AnglesCos[45];
logic [7:0] AnglesSin[45];
always_comb
begin
AnglesSin[0] = 8'b0000_0000;
AnglesSin[1] = 8'b0000_0010 ;
AnglesSin[2] = 8'b0000_0100 ;
AnglesSin[3] = 8'b0000_0111 ;
AnglesSin[4] = 8'b0000_1000 ;
AnglesSin[5] = 8'b0000_1010 ;
AnglesSin[6] = 8'b0000_1100 ;
AnglesSin[7] = 8'b0000_1101 ;
AnglesSin[8] = 8'b0000_1110 ;
AnglesSin[9] = 8'b0000_1111 ;
AnglesSin[10] = 8'b0001_0000 ;
AnglesSin[11] = 8'b0001_0000 ;
AnglesSin[12] = 8'b0001_0000 ;
AnglesSin[13] = 8'b0001_0000 ;
AnglesSin[14] = 8'b0000_1111 ;
AnglesSin[15] = 8'b0000_1110 ;
AnglesSin[16] = 8'b0000_1101 ;
AnglesSin[17] = 8'b0000_1011 ;
AnglesSin[18] = 8'b0000_1001 ;
AnglesSin[19] = 8'b0000_1000 ;
AnglesSin[20] = 8'b0000_0101 ;
AnglesSin[21] = 8'b0000_0011 ;
AnglesSin[22] = 8'b0000_0001 ;
AnglesSin[23] = 8'b0000_0001 ;
AnglesSin[24] = 8'b0000_0011 ;
AnglesSin[25] = 8'b0000_0101 ;
AnglesSin[26] = 8'b0000_1000 ;
AnglesSin[27] = 8'b0000_1001 ;
AnglesSin[28] = 8'b0000_1011 ;
AnglesSin[29] = 8'b0000_1101 ;
AnglesSin[30] = 8'b0000_1110 ;
AnglesSin[31] = 8'b0000_1111 ;
AnglesSin[32] = 8'b0001_0000 ;
AnglesSin[33] = 8'b0001_0000 ;
AnglesSin[34] = 8'b0001_0000 ;
AnglesSin[35] = 8'b0001_0000 ;
AnglesSin[36] = 8'b0000_1111 ;
AnglesSin[37] = 8'b0000_1110 ;
AnglesSin[38] = 8'b0000_1101 ;
AnglesSin[39] = 8'b0000_1100 ;
AnglesSin[40] = 8'b0000_1010 ;
AnglesSin[41] = 8'b0000_1000 ;
AnglesSin[42] = 8'b0000_0111 ;
AnglesSin[43] = 8'b0000_0100 ;
AnglesSin[44] = 8'b0000_0010 ;
AnglesCos[0] = 8'b0001_0000;
AnglesCos[1] = 8'b0001_0000;
AnglesCos[2] = 8'b0000_1111;
AnglesCos[3] = 8'b0000_1111;
AnglesCos[4] = 8'b0000_1110;
AnglesCos[5] = 8'b0000_1100;
AnglesCos[6] = 8'b0000_1011;
AnglesCos[7] = 8'b0000_1001;
AnglesCos[8] = 8'b0000_0111;
AnglesCos[9] = 8'b0000_0101;
AnglesCos[10] = 8'b0000_0011;
AnglesCos[11] = 8'b0000_0001;
AnglesCos[12] = 8'b0000_0010;
AnglesCos[13] = 8'b0000_0100;
AnglesCos[14] = 8'b0000_0110;
AnglesCos[15] = 8'b0000_1000;
AnglesCos[16] = 8'b0000_1010;
AnglesCos[17] = 8'b0000_1100;
AnglesCos[18] = 8'b0000_1101;
AnglesCos[19] = 8'b0000_1110;
AnglesCos[20] = 8'b0000_1111;
AnglesCos[21] = 8'b0001_0000;
AnglesCos[22] = 8'b0001_0000;
AnglesCos[23] = 8'b0001_0000;
AnglesCos[24] = 8'b0001_0000;
AnglesCos[25] = 8'b0000_1111;
AnglesCos[26] = 8'b0000_1110;
AnglesCos[27] = 8'b0000_1101;
AnglesCos[28] = 8'b0000_1100;
AnglesCos[29] = 8'b0000_1010;
AnglesCos[30] = 8'b0000_1000;
AnglesCos[31] = 8'b0000_0110;
AnglesCos[32] = 8'b0000_0100;
AnglesCos[33] = 8'b0000_0010;
AnglesCos[34] = 8'b0000_0001;
AnglesCos[35] = 8'b0000_0011;
AnglesCos[36] = 8'b0000_0101;
AnglesCos[37] = 8'b0000_0111;
AnglesCos[38] = 8'b0000_1001;
AnglesCos[39] = 8'b0000_1011;
AnglesCos[40] = 8'b0000_1100;
AnglesCos[41] = 8'b0000_1110;
AnglesCos[42] = 8'b0000_1111;
AnglesCos[43] = 8'b0000_1111;
AnglesCos[44] = 8'b0001_0000;
end
assign sin = AnglesSin[AngleI][7:0];
assign cos = AnglesCos[AngleI][7:0];
endmodule