OpenCores
URL https://opencores.org/ocsvn/fast_antilog/fast_antilog/trunk

Subversion Repositories fast_antilog

[/] [fast_antilog/] [trunk/] [AntiLog2.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 MichaelDun
module AntiLog2
2
 
3
/*
4
A fast base-2 anti-logarithm function, 10 bits in, 24 bits out.
5
Designed and coded by: Michael Dunn, http://www.cantares.on.ca/
6
Executes every cycle, with a latency of 2.
7
 
8
The input and output have binary points: In: xxxx.yyyy_yy; Out: xxxx_xxxx_xxxx_xxxx.yyyy_yyyy
9
 
10
License: Free to use & modify, but please keep this header intact.
11
August 8, 2010, Kitchener, Ontario, Canada
12
*/
13
 
14
(
15
        input [9:0]      DIN,
16
        input                   clk,
17
 
18
        output reg      [23:0]   DOUT
19
);
20
 
21
 
22
// Comprises 2 main blocks: barrel shifter & LUT
23
 
24
reg     [3:0]    barrelshfcnt;
25
reg     [22:0]   LUTout;
26
 
27
wire [38:0] tmp1 =       ({1'b1, LUTout}  <<  barrelshfcnt);
28
 
29
always @(posedge clk)
30
begin
31
        barrelshfcnt    <=      DIN[9:6];
32
        DOUT                    <=      tmp1[38:15];
33
end
34
 
35
 
36
//LUT for one octave of antilog lookup
37
// The equation is: output = (2^(input/64)-1) * 2^23
38
// For larger tables, better to generate a separate data file using a program!
39
 
40
always @(posedge clk)
41
case (DIN[5:0])
42
 
43
        0:       LUTout  <=      0;
44
        1:      LUTout  <=      91346;
45
        2:      LUTout  <=      183687;
46
        3:      LUTout  <=      277033;
47
        4:      LUTout  <=      371395;
48
        5:      LUTout  <=      466786;
49
        6:      LUTout  <=      563215;
50
        7:      LUTout  <=      660693;
51
        8:      LUTout  <=      759234;
52
        9:      LUTout  <=      858847;
53
        10:     LUTout  <=      959546;
54
        11:     LUTout  <=      1061340;
55
        12:     LUTout  <=      1164243;
56
        13:     LUTout  <=      1268267;
57
        14:     LUTout  <=      1373424;
58
        15:     LUTout  <=      1479725;
59
        16:     LUTout  <=      1587184;
60
        17:     LUTout  <=      1695814;
61
        18:     LUTout  <=      1805626;
62
        19:     LUTout  <=      1916634;
63
        20:     LUTout  <=      2028850;
64
        21:     LUTout  <=      2142289;
65
        22:     LUTout  <=      2256963;
66
        23:     LUTout  <=      2372886;
67
        24:     LUTout  <=      2490071;
68
        25:     LUTout  <=      2608532;
69
        26:     LUTout  <=      2728283;
70
        27:     LUTout  <=      2849338;
71
        28:     LUTout  <=      2971711;
72
        29:     LUTout  <=      3095417;
73
        30:     LUTout  <=      3220470;
74
        31:     LUTout  <=      3346884;
75
        32:     LUTout  <=      3474675;
76
        33:     LUTout  <=      3603858;
77
        34:     LUTout  <=      3734447;
78
        35:     LUTout  <=      3866459;
79
        36:     LUTout  <=      3999908;
80
        37:     LUTout  <=      4134810;
81
        38:     LUTout  <=      4271181;
82
        39:     LUTout  <=      4409037;
83
        40:     LUTout  <=      4548394;
84
        41:     LUTout  <=      4689269;
85
        42:     LUTout  <=      4831678;
86
        43:     LUTout  <=      4975637;
87
        44:     LUTout  <=      5121164;
88
        45:     LUTout  <=      5268276;
89
        46:     LUTout  <=      5416990;
90
        47:     LUTout  <=      5567323;
91
        48:     LUTout  <=      5719293;
92
        49:     LUTout  <=      5872918;
93
        50:     LUTout  <=      6028216;
94
        51:     LUTout  <=      6185205;
95
        52:     LUTout  <=      6343903;
96
        53:     LUTout  <=      6504329;
97
        54:     LUTout  <=      6666503;
98
        55:     LUTout  <=      6830442;
99
        56:     LUTout  <=      6996167;
100
        57:     LUTout  <=      7163696;
101
        58:     LUTout  <=      7333050;
102
        59:     LUTout  <=      7504247;
103
        60:     LUTout  <=      7677309;
104
        61:     LUTout  <=      7852255;
105
        62:     LUTout  <=      8029107;
106
        63:     LUTout  <=      8207884;
107
 
108
endcase
109
 
110
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2020 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.