1 |
5 |
iamalien |
--*************************************************************************
|
2 |
|
|
-- Project : 16 Quadrature Amplitude Demodulator *
|
3 |
|
|
-- *
|
4 |
|
|
-- File Name : QADM_16.vhd *
|
5 |
|
|
-- *
|
6 |
|
|
-- Author : Kaustubh Chaudhari *
|
7 |
|
|
-- *
|
8 |
|
|
-- Email : kaustubhcha305@gmail.com *
|
9 |
|
|
-- *
|
10 |
|
|
-- Description: 16 QADM, requires 10 bit QAM i/p and gives 4 bit Demod o/p*
|
11 |
|
|
-- *
|
12 |
|
|
--*************************************************************************
|
13 |
|
|
-- *
|
14 |
|
|
-- Copyright (C) 2016 Author *
|
15 |
|
|
-- *
|
16 |
|
|
-- This program is free software: you can redistribute it and/or modify *
|
17 |
|
|
-- it under the terms of the GNU General Public License as published by *
|
18 |
|
|
-- the Free Software Foundation, either version 3 of the License, or *
|
19 |
|
|
-- (at your option) any later version. *
|
20 |
|
|
-- *
|
21 |
|
|
-- This program is distributed in the hope that it will be useful, *
|
22 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
23 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
24 |
|
|
-- GNU General Public License for more details. *
|
25 |
|
|
-- *
|
26 |
|
|
-- You should have received a copy of the GNU General Public License *
|
27 |
|
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
28 |
|
|
--*************************************************************************
|
29 |
|
|
library IEEE;
|
30 |
|
|
use IEEE.STD_LOGIC_1164.ALL;
|
31 |
|
|
use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
32 |
|
|
USE IEEE.NUMERIC_STD.ALL;
|
33 |
|
|
|
34 |
|
|
entity QADM_16 is
|
35 |
|
|
PORT(output: OUT std_logic_vector(3 downto 0); --4 bit output depending on i/p QAM wave
|
36 |
|
|
clk: IN std_logic; --clock
|
37 |
|
|
inp: IN std_logic_vector(9 downto 0) --input in 10bit resolution
|
38 |
|
|
);
|
39 |
|
|
end QADM_16;
|
40 |
|
|
|
41 |
|
|
architecture Behavioral of QADM_16 is
|
42 |
|
|
type sine_array is array (0 to 2047) of integer range 0 to 1023;
|
43 |
|
|
signal sine1 : sine_array:=(512, 513, 514, 515, 515, 516, 517, 518, 519, 519, 520, 521, 522, 522, 523, 524,
|
44 |
|
|
525, 526, 526, 527, 528, 529, 529, 530, 531, 532, 533, 533, 534, 535, 536, 536,
|
45 |
|
|
537, 538, 539, 539, 540, 541, 542, 542, 543, 544, 545, 546, 546, 547, 548, 549,
|
46 |
|
|
549, 550, 551, 551, 552, 553, 554, 554, 555, 556, 557, 557, 558, 559, 560, 560,
|
47 |
|
|
561, 562, 562, 563, 564, 565, 565, 566, 567, 567, 568, 569, 570, 570, 571, 572,
|
48 |
|
|
572, 573, 574, 574, 575, 576, 576, 577, 578, 578, 579, 580, 580, 581, 582, 582,
|
49 |
|
|
583, 584, 584, 585, 586, 586, 587, 587, 588, 589, 589, 590, 591, 591, 592, 592,
|
50 |
|
|
593, 594, 594, 595, 595, 596, 597, 597, 598, 598, 599, 599, 600, 601, 601, 602,
|
51 |
|
|
602, 603, 603, 604, 604, 605, 605, 606, 606, 607, 608, 608, 609, 609, 610, 610,
|
52 |
|
|
611, 611, 612, 612, 612, 613, 613, 614, 614, 615, 615, 616, 616, 617, 617, 618,
|
53 |
|
|
618, 618, 619, 619, 620, 620, 620, 621, 621, 622, 622, 622, 623, 623, 624, 624,
|
54 |
|
|
624, 625, 625, 625, 626, 626, 626, 627, 627, 627, 628, 628, 628, 629, 629, 629,
|
55 |
|
|
630, 630, 630, 630, 631, 631, 631, 632, 632, 632, 632, 633, 633, 633, 633, 634,
|
56 |
|
|
634, 634, 634, 634, 635, 635, 635, 635, 635, 636, 636, 636, 636, 636, 636, 637,
|
57 |
|
|
637, 637, 637, 637, 637, 637, 638, 638, 638, 638, 638, 638, 638, 638, 638, 638,
|
58 |
|
|
638, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639,
|
59 |
|
|
639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 638, 638,
|
60 |
|
|
638, 638, 638, 638, 638, 638, 638, 638, 638, 637, 637, 637, 637, 637, 637, 637,
|
61 |
|
|
636, 636, 636, 636, 636, 636, 635, 635, 635, 635, 635, 634, 634, 634, 634, 634,
|
62 |
|
|
633, 633, 633, 633, 632, 632, 632, 632, 631, 631, 631, 630, 630, 630, 630, 629,
|
63 |
|
|
629, 629, 628, 628, 628, 627, 627, 627, 626, 626, 626, 625, 625, 625, 624, 624,
|
64 |
|
|
624, 623, 623, 622, 622, 622, 621, 621, 620, 620, 620, 619, 619, 618, 618, 618,
|
65 |
|
|
617, 617, 616, 616, 615, 615, 614, 614, 613, 613, 612, 612, 612, 611, 611, 610,
|
66 |
|
|
610, 609, 609, 608, 608, 607, 606, 606, 605, 605, 604, 604, 603, 603, 602, 602,
|
67 |
|
|
601, 601, 600, 599, 599, 598, 598, 597, 597, 596, 595, 595, 594, 594, 593, 592,
|
68 |
|
|
592, 591, 591, 590, 589, 589, 588, 587, 587, 586, 586, 585, 584, 584, 583, 582,
|
69 |
|
|
582, 581, 580, 580, 579, 578, 578, 577, 576, 576, 575, 574, 574, 573, 572, 572,
|
70 |
|
|
571, 570, 570, 569, 568, 567, 567, 566, 565, 565, 564, 563, 562, 562, 561, 560,
|
71 |
|
|
560, 559, 558, 557, 557, 556, 555, 554, 554, 553, 552, 551, 551, 550, 549, 549,
|
72 |
|
|
548, 547, 546, 546, 545, 544, 543, 542, 542, 541, 540, 539, 539, 538, 537, 536,
|
73 |
|
|
536, 535, 534, 533, 533, 532, 531, 530, 529, 529, 528, 527, 526, 526, 525, 524,
|
74 |
|
|
523, 522, 522, 521, 520, 519, 519, 518, 517, 516, 515, 515, 514, 513, 512, 512,
|
75 |
|
|
511, 510, 509, 508, 508, 507, 506, 505, 504, 504, 503, 502, 501, 501, 500, 499,
|
76 |
|
|
498, 497, 497, 496, 495, 494, 494, 493, 492, 491, 490, 490, 489, 488, 487, 487,
|
77 |
|
|
486, 485, 484, 484, 483, 482, 481, 481, 480, 479, 478, 477, 477, 476, 475, 474,
|
78 |
|
|
474, 473, 472, 472, 471, 470, 469, 469, 468, 467, 466, 466, 465, 464, 463, 463,
|
79 |
|
|
462, 461, 461, 460, 459, 458, 458, 457, 456, 456, 455, 454, 453, 453, 452, 451,
|
80 |
|
|
451, 450, 449, 449, 448, 447, 447, 446, 445, 445, 444, 443, 443, 442, 441, 441,
|
81 |
|
|
440, 439, 439, 438, 437, 437, 436, 436, 435, 434, 434, 433, 432, 432, 431, 431,
|
82 |
|
|
430, 429, 429, 428, 428, 427, 426, 426, 425, 425, 424, 424, 423, 422, 422, 421,
|
83 |
|
|
421, 420, 420, 419, 419, 418, 418, 417, 417, 416, 415, 415, 414, 414, 413, 413,
|
84 |
|
|
412, 412, 411, 411, 411, 410, 410, 409, 409, 408, 408, 407, 407, 406, 406, 405,
|
85 |
|
|
405, 405, 404, 404, 403, 403, 403, 402, 402, 401, 401, 401, 400, 400, 399, 399,
|
86 |
|
|
399, 398, 398, 398, 397, 397, 397, 396, 396, 396, 395, 395, 395, 394, 394, 394,
|
87 |
|
|
393, 393, 393, 393, 392, 392, 392, 391, 391, 391, 391, 390, 390, 390, 390, 389,
|
88 |
|
|
389, 389, 389, 389, 388, 388, 388, 388, 388, 387, 387, 387, 387, 387, 387, 386,
|
89 |
|
|
386, 386, 386, 386, 386, 386, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385,
|
90 |
|
|
385, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384,
|
91 |
|
|
384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 385, 385,
|
92 |
|
|
385, 385, 385, 385, 385, 385, 385, 385, 385, 386, 386, 386, 386, 386, 386, 386,
|
93 |
|
|
387, 387, 387, 387, 387, 387, 388, 388, 388, 388, 388, 389, 389, 389, 389, 389,
|
94 |
|
|
390, 390, 390, 390, 391, 391, 391, 391, 392, 392, 392, 393, 393, 393, 393, 394,
|
95 |
|
|
394, 394, 395, 395, 395, 396, 396, 396, 397, 397, 397, 398, 398, 398, 399, 399,
|
96 |
|
|
399, 400, 400, 401, 401, 401, 402, 402, 403, 403, 403, 404, 404, 405, 405, 405,
|
97 |
|
|
406, 406, 407, 407, 408, 408, 409, 409, 410, 410, 411, 411, 411, 412, 412, 413,
|
98 |
|
|
413, 414, 414, 415, 415, 416, 417, 417, 418, 418, 419, 419, 420, 420, 421, 421,
|
99 |
|
|
422, 422, 423, 424, 424, 425, 425, 426, 426, 427, 428, 428, 429, 429, 430, 431,
|
100 |
|
|
431, 432, 432, 433, 434, 434, 435, 436, 436, 437, 437, 438, 439, 439, 440, 441,
|
101 |
|
|
441, 442, 443, 443, 444, 445, 445, 446, 447, 447, 448, 449, 449, 450, 451, 451,
|
102 |
|
|
452, 453, 453, 454, 455, 456, 456, 457, 458, 458, 459, 460, 461, 461, 462, 463,
|
103 |
|
|
463, 464, 465, 466, 466, 467, 468, 469, 469, 470, 471, 472, 472, 473, 474, 474,
|
104 |
|
|
475, 476, 477, 477, 478, 479, 480, 481, 481, 482, 483, 484, 484, 485, 486, 487,
|
105 |
|
|
487, 488, 489, 490, 490, 491, 492, 493, 494, 494, 495, 496, 497, 497, 498, 499,
|
106 |
|
|
500, 501, 501, 502, 503, 504, 504, 505, 506, 507, 508, 508, 509, 510, 511, 512,
|
107 |
|
|
512, 513, 514, 515, 515, 516, 517, 518, 519, 519, 520, 521, 522, 522, 523, 524,
|
108 |
|
|
525, 526, 526, 527, 528, 529, 529, 530, 531, 532, 533, 533, 534, 535, 536, 536,
|
109 |
|
|
537, 538, 539, 539, 540, 541, 542, 542, 543, 544, 545, 546, 546, 547, 548, 549,
|
110 |
|
|
549, 550, 551, 551, 552, 553, 554, 554, 555, 556, 557, 557, 558, 559, 560, 560,
|
111 |
|
|
561, 562, 562, 563, 564, 565, 565, 566, 567, 567, 568, 569, 570, 570, 571, 572,
|
112 |
|
|
572, 573, 574, 574, 575, 576, 576, 577, 578, 578, 579, 580, 580, 581, 582, 582,
|
113 |
|
|
583, 584, 584, 585, 586, 586, 587, 587, 588, 589, 589, 590, 591, 591, 592, 592,
|
114 |
|
|
593, 594, 594, 595, 595, 596, 597, 597, 598, 598, 599, 599, 600, 601, 601, 602,
|
115 |
|
|
602, 603, 603, 604, 604, 605, 605, 606, 606, 607, 608, 608, 609, 609, 610, 610,
|
116 |
|
|
611, 611, 612, 612, 612, 613, 613, 614, 614, 615, 615, 616, 616, 617, 617, 618,
|
117 |
|
|
618, 618, 619, 619, 620, 620, 620, 621, 621, 622, 622, 622, 623, 623, 624, 624,
|
118 |
|
|
624, 625, 625, 625, 626, 626, 626, 627, 627, 627, 628, 628, 628, 629, 629, 629,
|
119 |
|
|
630, 630, 630, 630, 631, 631, 631, 632, 632, 632, 632, 633, 633, 633, 633, 634,
|
120 |
|
|
634, 634, 634, 634, 635, 635, 635, 635, 635, 636, 636, 636, 636, 636, 636, 637,
|
121 |
|
|
637, 637, 637, 637, 637, 637, 638, 638, 638, 638, 638, 638, 638, 638, 638, 638,
|
122 |
|
|
638, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639,
|
123 |
|
|
639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 638, 638,
|
124 |
|
|
638, 638, 638, 638, 638, 638, 638, 638, 638, 637, 637, 637, 637, 637, 637, 637,
|
125 |
|
|
636, 636, 636, 636, 636, 636, 635, 635, 635, 635, 635, 634, 634, 634, 634, 634,
|
126 |
|
|
633, 633, 633, 633, 632, 632, 632, 632, 631, 631, 631, 630, 630, 630, 630, 629,
|
127 |
|
|
629, 629, 628, 628, 628, 627, 627, 627, 626, 626, 626, 625, 625, 625, 624, 624,
|
128 |
|
|
624, 623, 623, 622, 622, 622, 621, 621, 620, 620, 620, 619, 619, 618, 618, 618,
|
129 |
|
|
617, 617, 616, 616, 615, 615, 614, 614, 613, 613, 612, 612, 612, 611, 611, 610,
|
130 |
|
|
610, 609, 609, 608, 608, 607, 606, 606, 605, 605, 604, 604, 603, 603, 602, 602,
|
131 |
|
|
601, 601, 600, 599, 599, 598, 598, 597, 597, 596, 595, 595, 594, 594, 593, 592,
|
132 |
|
|
592, 591, 591, 590, 589, 589, 588, 587, 587, 586, 586, 585, 584, 584, 583, 582,
|
133 |
|
|
582, 581, 580, 580, 579, 578, 578, 577, 576, 576, 575, 574, 574, 573, 572, 572,
|
134 |
|
|
571, 570, 570, 569, 568, 567, 567, 566, 565, 565, 564, 563, 562, 562, 561, 560,
|
135 |
|
|
560, 559, 558, 557, 557, 556, 555, 554, 554, 553, 552, 551, 551, 550, 549, 549,
|
136 |
|
|
548, 547, 546, 546, 545, 544, 543, 542, 542, 541, 540, 539, 539, 538, 537, 536,
|
137 |
|
|
536, 535, 534, 533, 533, 532, 531, 530, 529, 529, 528, 527, 526, 526, 525, 524,
|
138 |
|
|
523, 522, 522, 521, 520, 519, 519, 518, 517, 516, 515, 515, 514, 513, 512, 512,
|
139 |
|
|
511, 510, 509, 508, 508, 507, 506, 505, 504, 504, 503, 502, 501, 501, 500, 499,
|
140 |
|
|
498, 497, 497, 496, 495, 494, 494, 493, 492, 491, 490, 490, 489, 488, 487, 487,
|
141 |
|
|
486, 485, 484, 484, 483, 482, 481, 481, 480, 479, 478, 477, 477, 476, 475, 474,
|
142 |
|
|
474, 473, 472, 472, 471, 470, 469, 469, 468, 467, 466, 466, 465, 464, 463, 463,
|
143 |
|
|
462, 461, 461, 460, 459, 458, 458, 457, 456, 456, 455, 454, 453, 453, 452, 451,
|
144 |
|
|
451, 450, 449, 449, 448, 447, 447, 446, 445, 445, 444, 443, 443, 442, 441, 441,
|
145 |
|
|
440, 439, 439, 438, 437, 437, 436, 436, 435, 434, 434, 433, 432, 432, 431, 431,
|
146 |
|
|
430, 429, 429, 428, 428, 427, 426, 426, 425, 425, 424, 424, 423, 422, 422, 421,
|
147 |
|
|
421, 420, 420, 419, 419, 418, 418, 417, 417, 416, 415, 415, 414, 414, 413, 413,
|
148 |
|
|
412, 412, 411, 411, 411, 410, 410, 409, 409, 408, 408, 407, 407, 406, 406, 405,
|
149 |
|
|
405, 405, 404, 404, 403, 403, 403, 402, 402, 401, 401, 401, 400, 400, 399, 399,
|
150 |
|
|
399, 398, 398, 398, 397, 397, 397, 396, 396, 396, 395, 395, 395, 394, 394, 394,
|
151 |
|
|
393, 393, 393, 393, 392, 392, 392, 391, 391, 391, 391, 390, 390, 390, 390, 389,
|
152 |
|
|
389, 389, 389, 389, 388, 388, 388, 388, 388, 387, 387, 387, 387, 387, 387, 386,
|
153 |
|
|
386, 386, 386, 386, 386, 386, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385,
|
154 |
|
|
385, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384,
|
155 |
|
|
384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 385, 385,
|
156 |
|
|
385, 385, 385, 385, 385, 385, 385, 385, 385, 386, 386, 386, 386, 386, 386, 386,
|
157 |
|
|
387, 387, 387, 387, 387, 387, 388, 388, 388, 388, 388, 389, 389, 389, 389, 389,
|
158 |
|
|
390, 390, 390, 390, 391, 391, 391, 391, 392, 392, 392, 393, 393, 393, 393, 394,
|
159 |
|
|
394, 394, 395, 395, 395, 396, 396, 396, 397, 397, 397, 398, 398, 398, 399, 399,
|
160 |
|
|
399, 400, 400, 401, 401, 401, 402, 402, 403, 403, 403, 404, 404, 405, 405, 405,
|
161 |
|
|
406, 406, 407, 407, 408, 408, 409, 409, 410, 410, 411, 411, 411, 412, 412, 413,
|
162 |
|
|
413, 414, 414, 415, 415, 416, 417, 417, 418, 418, 419, 419, 420, 420, 421, 421,
|
163 |
|
|
422, 422, 423, 424, 424, 425, 425, 426, 426, 427, 428, 428, 429, 429, 430, 431,
|
164 |
|
|
431, 432, 432, 433, 434, 434, 435, 436, 436, 437, 437, 438, 439, 439, 440, 441,
|
165 |
|
|
441, 442, 443, 443, 444, 445, 445, 446, 447, 447, 448, 449, 449, 450, 451, 451,
|
166 |
|
|
452, 453, 453, 454, 455, 456, 456, 457, 458, 458, 459, 460, 461, 461, 462, 463,
|
167 |
|
|
463, 464, 465, 466, 466, 467, 468, 469, 469, 470, 471, 472, 472, 473, 474, 474,
|
168 |
|
|
475, 476, 477, 477, 478, 479, 480, 481, 481, 482, 483, 484, 484, 485, 486, 487,
|
169 |
|
|
487, 488, 489, 490, 490, 491, 492, 493, 494, 494, 495, 496, 497, 497, 498, 499,
|
170 |
|
|
500, 501, 501, 502, 503, 504, 504, 505, 506, 507, 508, 508, 509, 510, 511, 512);
|
171 |
|
|
signal sine2 : sine_array:=(512, 515, 516, 518, 519, 521, 522, 524, 526, 527, 529, 530, 532, 533, 535, 537,
|
172 |
|
|
538, 540, 541, 543, 544, 546, 547, 549, 551, 552, 554, 555, 557, 558, 560, 561,
|
173 |
|
|
563, 564, 566, 567, 569, 571, 572, 574, 575, 577, 578, 580, 581, 583, 584, 586,
|
174 |
|
|
587, 589, 590, 592, 593, 595, 596, 598, 599, 601, 602, 603, 605, 606, 608, 609,
|
175 |
|
|
611, 612, 614, 615, 616, 618, 619, 621, 622, 624, 625, 626, 628, 629, 631, 632,
|
176 |
|
|
633, 635, 636, 637, 639, 640, 642, 643, 644, 646, 647, 648, 650, 651, 652, 653,
|
177 |
|
|
655, 656, 657, 659, 660, 661, 662, 664, 665, 666, 667, 669, 670, 671, 672, 674,
|
178 |
|
|
675, 676, 677, 678, 680, 681, 682, 683, 684, 685, 687, 688, 689, 690, 691, 692,
|
179 |
|
|
693, 694, 695, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709,
|
180 |
|
|
710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 719, 720, 721, 722, 723, 724,
|
181 |
|
|
725, 726, 727, 727, 728, 729, 730, 731, 731, 732, 733, 734, 735, 735, 736, 737,
|
182 |
|
|
738, 738, 739, 740, 740, 741, 742, 742, 743, 744, 744, 745, 746, 746, 747, 748,
|
183 |
|
|
748, 749, 749, 750, 750, 751, 752, 752, 753, 753, 754, 754, 755, 755, 756, 756,
|
184 |
|
|
756, 757, 757, 758, 758, 759, 759, 759, 760, 760, 760, 761, 761, 761, 762, 762,
|
185 |
|
|
762, 763, 763, 763, 764, 764, 764, 764, 764, 765, 765, 765, 765, 765, 766, 766,
|
186 |
|
|
766, 766, 766, 766, 766, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767,
|
187 |
|
|
767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 766, 766, 766, 766, 766, 766,
|
188 |
|
|
766, 765, 765, 765, 765, 765, 764, 764, 764, 764, 764, 763, 763, 763, 762, 762,
|
189 |
|
|
762, 761, 761, 761, 760, 760, 760, 759, 759, 759, 758, 758, 757, 757, 756, 756,
|
190 |
|
|
756, 755, 755, 754, 754, 753, 753, 752, 752, 751, 750, 750, 749, 749, 748, 748,
|
191 |
|
|
747, 746, 746, 745, 744, 744, 743, 742, 742, 741, 740, 740, 739, 738, 738, 737,
|
192 |
|
|
736, 735, 735, 734, 733, 732, 731, 731, 730, 729, 728, 727, 727, 726, 725, 724,
|
193 |
|
|
723, 722, 721, 720, 719, 719, 718, 717, 716, 715, 714, 713, 712, 711, 710, 709,
|
194 |
|
|
708, 707, 706, 705, 704, 703, 702, 701, 700, 699, 698, 697, 695, 694, 693, 692,
|
195 |
|
|
691, 690, 689, 688, 687, 685, 684, 683, 682, 681, 680, 678, 677, 676, 675, 674,
|
196 |
|
|
672, 671, 670, 669, 667, 666, 665, 664, 662, 661, 660, 659, 657, 656, 655, 653,
|
197 |
|
|
652, 651, 650, 648, 647, 646, 644, 643, 642, 640, 639, 637, 636, 635, 633, 632,
|
198 |
|
|
631, 629, 628, 626, 625, 624, 622, 621, 619, 618, 616, 615, 614, 612, 611, 609,
|
199 |
|
|
608, 606, 605, 603, 602, 601, 599, 598, 596, 595, 593, 592, 590, 589, 587, 586,
|
200 |
|
|
584, 583, 581, 580, 578, 577, 575, 574, 572, 571, 569, 567, 566, 564, 563, 561,
|
201 |
|
|
560, 558, 557, 555, 554, 552, 551, 549, 547, 546, 544, 543, 541, 540, 538, 537,
|
202 |
|
|
535, 533, 532, 530, 529, 527, 526, 524, 522, 521, 519, 518, 516, 515, 513, 512,
|
203 |
|
|
510, 508, 507, 505, 504, 502, 501, 499, 497, 496, 494, 493, 491, 490, 488, 486,
|
204 |
|
|
485, 483, 482, 480, 479, 477, 476, 474, 472, 471, 469, 468, 466, 465, 463, 462,
|
205 |
|
|
460, 459, 457, 456, 454, 452, 451, 449, 448, 446, 445, 443, 442, 440, 439, 437,
|
206 |
|
|
436, 434, 433, 431, 430, 428, 427, 425, 424, 422, 421, 420, 418, 417, 415, 414,
|
207 |
|
|
412, 411, 409, 408, 407, 405, 404, 402, 401, 399, 398, 397, 395, 394, 392, 391,
|
208 |
|
|
390, 388, 387, 386, 384, 383, 381, 380, 379, 377, 376, 375, 373, 372, 371, 370,
|
209 |
|
|
368, 367, 366, 364, 363, 362, 361, 359, 358, 357, 356, 354, 353, 352, 351, 349,
|
210 |
|
|
348, 347, 346, 345, 343, 342, 341, 340, 339, 338, 336, 335, 334, 333, 332, 331,
|
211 |
|
|
330, 329, 328, 326, 325, 324, 323, 322, 321, 320, 319, 318, 317, 316, 315, 314,
|
212 |
|
|
313, 312, 311, 310, 309, 308, 307, 306, 305, 304, 304, 303, 302, 301, 300, 299,
|
213 |
|
|
298, 297, 296, 296, 295, 294, 293, 292, 292, 291, 290, 289, 288, 288, 287, 286,
|
214 |
|
|
285, 285, 284, 283, 283, 282, 281, 281, 280, 279, 279, 278, 277, 277, 276, 275,
|
215 |
|
|
275, 274, 274, 273, 273, 272, 271, 271, 270, 270, 269, 269, 268, 268, 267, 267,
|
216 |
|
|
267, 266, 266, 265, 265, 264, 264, 264, 263, 263, 263, 262, 262, 262, 261, 261,
|
217 |
|
|
261, 260, 260, 260, 259, 259, 259, 259, 259, 258, 258, 258, 258, 258, 257, 257,
|
218 |
|
|
257, 257, 257, 257, 257, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
219 |
|
|
256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 257, 257, 257, 257, 257, 257,
|
220 |
|
|
257, 258, 258, 258, 258, 258, 259, 259, 259, 259, 259, 260, 260, 260, 261, 261,
|
221 |
|
|
261, 262, 262, 262, 263, 263, 263, 264, 264, 264, 265, 265, 266, 266, 267, 267,
|
222 |
|
|
267, 268, 268, 269, 269, 270, 270, 271, 271, 272, 273, 273, 274, 274, 275, 275,
|
223 |
|
|
276, 277, 277, 278, 279, 279, 280, 281, 281, 282, 283, 283, 284, 285, 285, 286,
|
224 |
|
|
287, 288, 288, 289, 290, 291, 292, 292, 293, 294, 295, 296, 296, 297, 298, 299,
|
225 |
|
|
300, 301, 302, 303, 304, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
|
226 |
|
|
315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 328, 329, 330, 331,
|
227 |
|
|
332, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 345, 346, 347, 348, 349,
|
228 |
|
|
351, 352, 353, 354, 356, 357, 358, 359, 361, 362, 363, 364, 366, 367, 368, 370,
|
229 |
|
|
371, 372, 373, 375, 376, 377, 379, 380, 381, 383, 384, 386, 387, 388, 390, 391,
|
230 |
|
|
392, 394, 395, 397, 398, 399, 401, 402, 404, 405, 407, 408, 409, 411, 412, 414,
|
231 |
|
|
415, 417, 418, 420, 421, 422, 424, 425, 427, 428, 430, 431, 433, 434, 436, 437,
|
232 |
|
|
439, 440, 442, 443, 445, 446, 448, 449, 451, 452, 454, 456, 457, 459, 460, 462,
|
233 |
|
|
463, 465, 466, 468, 469, 471, 472, 474, 476, 477, 479, 480, 482, 483, 485, 486,
|
234 |
|
|
488, 490, 491, 493, 494, 496, 497, 499, 501, 502, 504, 505, 507, 508, 510, 512,
|
235 |
|
|
512, 515, 516, 518, 519, 521, 522, 524, 526, 527, 529, 530, 532, 533, 535, 537,
|
236 |
|
|
538, 540, 541, 543, 544, 546, 547, 549, 551, 552, 554, 555, 557, 558, 560, 561,
|
237 |
|
|
563, 564, 566, 567, 569, 571, 572, 574, 575, 577, 578, 580, 581, 583, 584, 586,
|
238 |
|
|
587, 589, 590, 592, 593, 595, 596, 598, 599, 601, 602, 603, 605, 606, 608, 609,
|
239 |
|
|
611, 612, 614, 615, 616, 618, 619, 621, 622, 624, 625, 626, 628, 629, 631, 632,
|
240 |
|
|
633, 635, 636, 637, 639, 640, 642, 643, 644, 646, 647, 648, 650, 651, 652, 653,
|
241 |
|
|
655, 656, 657, 659, 660, 661, 662, 664, 665, 666, 667, 669, 670, 671, 672, 674,
|
242 |
|
|
675, 676, 677, 678, 680, 681, 682, 683, 684, 685, 687, 688, 689, 690, 691, 692,
|
243 |
|
|
693, 694, 695, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709,
|
244 |
|
|
710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 719, 720, 721, 722, 723, 724,
|
245 |
|
|
725, 726, 727, 727, 728, 729, 730, 731, 731, 732, 733, 734, 735, 735, 736, 737,
|
246 |
|
|
738, 738, 739, 740, 740, 741, 742, 742, 743, 744, 744, 745, 746, 746, 747, 748,
|
247 |
|
|
748, 749, 749, 750, 750, 751, 752, 752, 753, 753, 754, 754, 755, 755, 756, 756,
|
248 |
|
|
756, 757, 757, 758, 758, 759, 759, 759, 760, 760, 760, 761, 761, 761, 762, 762,
|
249 |
|
|
762, 763, 763, 763, 764, 764, 764, 764, 764, 765, 765, 765, 765, 765, 766, 766,
|
250 |
|
|
766, 766, 766, 766, 766, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767,
|
251 |
|
|
767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 766, 766, 766, 766, 766, 766,
|
252 |
|
|
766, 765, 765, 765, 765, 765, 764, 764, 764, 764, 764, 763, 763, 763, 762, 762,
|
253 |
|
|
762, 761, 761, 761, 760, 760, 760, 759, 759, 759, 758, 758, 757, 757, 756, 756,
|
254 |
|
|
756, 755, 755, 754, 754, 753, 753, 752, 752, 751, 750, 750, 749, 749, 748, 748,
|
255 |
|
|
747, 746, 746, 745, 744, 744, 743, 742, 742, 741, 740, 740, 739, 738, 738, 737,
|
256 |
|
|
736, 735, 735, 734, 733, 732, 731, 731, 730, 729, 728, 727, 727, 726, 725, 724,
|
257 |
|
|
723, 722, 721, 720, 719, 719, 718, 717, 716, 715, 714, 713, 712, 711, 710, 709,
|
258 |
|
|
708, 707, 706, 705, 704, 703, 702, 701, 700, 699, 698, 697, 695, 694, 693, 692,
|
259 |
|
|
691, 690, 689, 688, 687, 685, 684, 683, 682, 681, 680, 678, 677, 676, 675, 674,
|
260 |
|
|
672, 671, 670, 669, 667, 666, 665, 664, 662, 661, 660, 659, 657, 656, 655, 653,
|
261 |
|
|
652, 651, 650, 648, 647, 646, 644, 643, 642, 640, 639, 637, 636, 635, 633, 632,
|
262 |
|
|
631, 629, 628, 626, 625, 624, 622, 621, 619, 618, 616, 615, 614, 612, 611, 609,
|
263 |
|
|
608, 606, 605, 603, 602, 601, 599, 598, 596, 595, 593, 592, 590, 589, 587, 586,
|
264 |
|
|
584, 583, 581, 580, 578, 577, 575, 574, 572, 571, 569, 567, 566, 564, 563, 561,
|
265 |
|
|
560, 558, 557, 555, 554, 552, 551, 549, 547, 546, 544, 543, 541, 540, 538, 537,
|
266 |
|
|
535, 533, 532, 530, 529, 527, 526, 524, 522, 521, 519, 518, 516, 515, 513, 512,
|
267 |
|
|
510, 508, 507, 505, 504, 502, 501, 499, 497, 496, 494, 493, 491, 490, 488, 486,
|
268 |
|
|
485, 483, 482, 480, 479, 477, 476, 474, 472, 471, 469, 468, 466, 465, 463, 462,
|
269 |
|
|
460, 459, 457, 456, 454, 452, 451, 449, 448, 446, 445, 443, 442, 440, 439, 437,
|
270 |
|
|
436, 434, 433, 431, 430, 428, 427, 425, 424, 422, 421, 420, 418, 417, 415, 414,
|
271 |
|
|
412, 411, 409, 408, 407, 405, 404, 402, 401, 399, 398, 397, 395, 394, 392, 391,
|
272 |
|
|
390, 388, 387, 386, 384, 383, 381, 380, 379, 377, 376, 375, 373, 372, 371, 370,
|
273 |
|
|
368, 367, 366, 364, 363, 362, 361, 359, 358, 357, 356, 354, 353, 352, 351, 349,
|
274 |
|
|
348, 347, 346, 345, 343, 342, 341, 340, 339, 338, 336, 335, 334, 333, 332, 331,
|
275 |
|
|
330, 329, 328, 326, 325, 324, 323, 322, 321, 320, 319, 318, 317, 316, 315, 314,
|
276 |
|
|
313, 312, 311, 310, 309, 308, 307, 306, 305, 304, 304, 303, 302, 301, 300, 299,
|
277 |
|
|
298, 297, 296, 296, 295, 294, 293, 292, 292, 291, 290, 289, 288, 288, 287, 286,
|
278 |
|
|
285, 285, 284, 283, 283, 282, 281, 281, 280, 279, 279, 278, 277, 277, 276, 275,
|
279 |
|
|
275, 274, 274, 273, 273, 272, 271, 271, 270, 270, 269, 269, 268, 268, 267, 267,
|
280 |
|
|
267, 266, 266, 265, 265, 264, 264, 264, 263, 263, 263, 262, 262, 262, 261, 261,
|
281 |
|
|
261, 260, 260, 260, 259, 259, 259, 259, 259, 258, 258, 258, 258, 258, 257, 257,
|
282 |
|
|
257, 257, 257, 257, 257, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
283 |
|
|
256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 257, 257, 257, 257, 257, 257,
|
284 |
|
|
257, 258, 258, 258, 258, 258, 259, 259, 259, 259, 259, 260, 260, 260, 261, 261,
|
285 |
|
|
261, 262, 262, 262, 263, 263, 263, 264, 264, 264, 265, 265, 266, 266, 267, 267,
|
286 |
|
|
267, 268, 268, 269, 269, 270, 270, 271, 271, 272, 273, 273, 274, 274, 275, 275,
|
287 |
|
|
276, 277, 277, 278, 279, 279, 280, 281, 281, 282, 283, 283, 284, 285, 285, 286,
|
288 |
|
|
287, 288, 288, 289, 290, 291, 292, 292, 293, 294, 295, 296, 296, 297, 298, 299,
|
289 |
|
|
300, 301, 302, 303, 304, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
|
290 |
|
|
315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 328, 329, 330, 331,
|
291 |
|
|
332, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 345, 346, 347, 348, 349,
|
292 |
|
|
351, 352, 353, 354, 356, 357, 358, 359, 361, 362, 363, 364, 366, 367, 368, 370,
|
293 |
|
|
371, 372, 373, 375, 376, 377, 379, 380, 381, 383, 384, 386, 387, 388, 390, 391,
|
294 |
|
|
392, 394, 395, 397, 398, 399, 401, 402, 404, 405, 407, 408, 409, 411, 412, 414,
|
295 |
|
|
415, 417, 418, 420, 421, 422, 424, 425, 427, 428, 430, 431, 433, 434, 436, 437,
|
296 |
|
|
439, 440, 442, 443, 445, 446, 448, 449, 451, 452, 454, 456, 457, 459, 460, 462,
|
297 |
|
|
463, 465, 466, 468, 469, 471, 472, 474, 476, 477, 479, 480, 482, 483, 485, 486,
|
298 |
|
|
488, 490, 491, 493, 494, 496, 497, 499, 501, 502, 504, 505, 507, 508, 510, 512);
|
299 |
|
|
signal buf1,buf2,buf3,buf4,buf5,buf6,buf7,buf8,buf9,buf10,buf11,buf12,buf13,buf14,buf15,buf16 : std_logic_vector(9 downto 0);
|
300 |
|
|
signal ctr : integer range 0 to 2047;
|
301 |
|
|
BEGIN
|
302 |
|
|
process(clk)
|
303 |
|
|
begin
|
304 |
|
|
if rising_edge(clk) then
|
305 |
|
|
if (ctr<1023) then
|
306 |
|
|
buf1 <= std_logic_vector(to_unsigned((sine1(ctr)+sine1(ctr+256)-512),10));
|
307 |
|
|
buf2 <= std_logic_vector(to_unsigned((sine1(ctr)+sine2(ctr+256)-512),10));
|
308 |
|
|
buf3 <= std_logic_vector(to_unsigned((sine1(ctr)+sine1(ctr+512+256)-512),10));
|
309 |
|
|
buf4 <= std_logic_vector(to_unsigned((sine1(ctr)+sine2(ctr+512+256)-512),10));
|
310 |
|
|
buf5 <= std_logic_vector(to_unsigned((sine2(ctr)+sine1(ctr+256)-512),10));
|
311 |
|
|
buf6 <= std_logic_vector(to_unsigned((sine2(ctr)+sine2(ctr+256)-512),10));
|
312 |
|
|
buf7 <= std_logic_vector(to_unsigned((sine2(ctr)+sine1(ctr+512+256)-512),10));
|
313 |
|
|
buf8 <= std_logic_vector(to_unsigned((sine2(ctr)+sine2(ctr+512+256)-512),10));
|
314 |
|
|
buf9 <= std_logic_vector(to_unsigned((sine1(ctr+512)+sine1(ctr+256)-512),10));
|
315 |
|
|
buf10 <= std_logic_vector(to_unsigned((sine1(ctr+512)+sine2(ctr+256)-512),10));
|
316 |
|
|
buf11 <= std_logic_vector(to_unsigned((sine1(ctr+512)+sine1(ctr+512+256)-512),10));
|
317 |
|
|
buf12 <= std_logic_vector(to_unsigned((sine1(ctr+512)+sine2(ctr+512+256)-512),10));
|
318 |
|
|
buf13 <= std_logic_vector(to_unsigned((sine2(ctr+512)+sine1(ctr+256)-512),10));
|
319 |
|
|
buf14 <= std_logic_vector(to_unsigned((sine2(ctr+512)+sine2(ctr+256)-512),10));
|
320 |
|
|
buf15 <= std_logic_vector(to_unsigned((sine2(ctr+512)+sine1(ctr+512+256)-512),10));
|
321 |
|
|
buf16 <= std_logic_vector(to_unsigned((sine2(ctr+512)+sine2(ctr+512+256)-512),10));
|
322 |
|
|
ctr<=ctr+1;
|
323 |
|
|
else
|
324 |
|
|
buf1 <= std_logic_vector(to_unsigned((sine1(ctr)+sine1(ctr+256)-512),10));
|
325 |
|
|
buf2 <= std_logic_vector(to_unsigned((sine1(ctr)+sine2(ctr+256)-512),10));
|
326 |
|
|
buf3 <= std_logic_vector(to_unsigned((sine1(ctr)+sine1(ctr+512+256)-512),10));
|
327 |
|
|
buf4 <= std_logic_vector(to_unsigned((sine1(ctr)+sine2(ctr+512+256)-512),10));
|
328 |
|
|
buf5 <= std_logic_vector(to_unsigned((sine2(ctr)+sine1(ctr+256)-512),10));
|
329 |
|
|
buf6 <= std_logic_vector(to_unsigned((sine2(ctr)+sine2(ctr+256)-512),10));
|
330 |
|
|
buf7 <= std_logic_vector(to_unsigned((sine2(ctr)+sine1(ctr+512+256)-512),10));
|
331 |
|
|
buf8 <= std_logic_vector(to_unsigned((sine2(ctr)+sine2(ctr+512+256)-512),10));
|
332 |
|
|
buf9 <= std_logic_vector(to_unsigned((sine1(ctr+512)+sine1(ctr+256)-512),10));
|
333 |
|
|
buf10 <= std_logic_vector(to_unsigned((sine1(ctr+512)+sine2(ctr+256)-512),10));
|
334 |
|
|
buf11 <= std_logic_vector(to_unsigned((sine1(ctr+512)+sine1(ctr+512+256)-512),10));
|
335 |
|
|
buf12 <= std_logic_vector(to_unsigned((sine1(ctr+512)+sine2(ctr+512+256)-512),10));
|
336 |
|
|
buf13 <= std_logic_vector(to_unsigned((sine2(ctr+512)+sine1(ctr+256)-512),10));
|
337 |
|
|
buf14 <= std_logic_vector(to_unsigned((sine2(ctr+512)+sine2(ctr+256)-512),10));
|
338 |
|
|
buf15 <= std_logic_vector(to_unsigned((sine2(ctr+512)+sine1(ctr+512+256)-512),10));
|
339 |
|
|
buf16 <= std_logic_vector(to_unsigned((sine2(ctr+512)+sine2(ctr+512+256)-512),10));
|
340 |
|
|
ctr<=0;
|
341 |
|
|
end if;
|
342 |
|
|
end if;
|
343 |
|
|
if inp=buf1 then output<="0000";
|
344 |
|
|
elsif inp=buf2 then output<="0001";
|
345 |
|
|
elsif inp=buf3 then output<="0010";
|
346 |
|
|
elsif inp=buf4 then output<="0011";
|
347 |
|
|
elsif inp=buf5 then output<="0100";
|
348 |
|
|
elsif inp=buf6 then output<="0101";
|
349 |
|
|
elsif inp=buf7 then output<="0110";
|
350 |
|
|
elsif inp=buf8 then output<="0111";
|
351 |
|
|
elsif inp=buf9 then output<="1000";
|
352 |
|
|
elsif inp=buf10 then output<="1001";
|
353 |
|
|
elsif inp=buf11 then output<="1010";
|
354 |
|
|
elsif inp=buf12 then output<="1011";
|
355 |
|
|
elsif inp=buf13 then output<="1100";
|
356 |
|
|
elsif inp=buf14 then output<="1101";
|
357 |
|
|
elsif inp=buf15 then output<="1110";
|
358 |
|
|
elsif inp=buf16 then output<="1111";
|
359 |
|
|
else output<="ZZZZ";
|
360 |
|
|
end if;
|
361 |
|
|
end process;
|
362 |
|
|
END;
|