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

Subversion Repositories simple_fm_receiver

[/] [simple_fm_receiver/] [trunk/] [source/] [sub_12bit.vhdl] - Blame information for rev 39

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 arif_endro
-- $Id: sub_12bit.vhdl,v 1.3 2005-03-04 08:06:21 arif_endro Exp $
2 2 arif_endro
-------------------------------------------------------------------------------
3
-- Title       : Subtractor 12 bit
4
-- Project     : FM Receiver 
5
-------------------------------------------------------------------------------
6
-- File        : sub_12bit.vhdl
7
-- Author      : "Arif E. Nugroho" <arif_endro@yahoo.com>
8
-- Created     : 2004/12/01
9
-- Last update : 
10 13 arif_endro
-- Simulators  : 
11 2 arif_endro
-- Synthesizers: 
12
-- Target      : 
13
-------------------------------------------------------------------------------
14
-- Description : Subtractor 12 bit used in loop filter
15
-------------------------------------------------------------------------------
16 39 arif_endro
-- Copyright (C) 2004 Arif Endro Nugroho
17 2 arif_endro
-------------------------------------------------------------------------------
18 13 arif_endro
-- 
19
--      THIS SOURCE FILE MAY BE USED AND DISTRIBUTED WITHOUT RESTRICTION
20
-- PROVIDED THAT THIS COPYRIGHT STATEMENT IS NOT REMOVED FROM THE FILE AND THAT
21
-- ANY DERIVATIVE WORK CONTAINS THE ORIGINAL COPYRIGHT NOTICE AND THE
22
-- ASSOCIATED DISCLAIMER.
23
-- 
24
-------------------------------------------------------------------------------
25
-- 
26
--      THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
27
-- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28
-- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
29
-- EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31
-- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
32
-- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
33
-- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34
-- OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
35
-- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
-- 
37
-------------------------------------------------------------------------------
38 2 arif_endro
 
39
library IEEE;
40
use IEEE.STD_LOGIC_1164.ALL;
41
 
42
entity sub_12bit is
43
   port (
44
      addend_12bit           : in  bit_vector (11 downto 0);
45
      subtrahend_12bit       : in  bit_vector (11 downto 0);
46
      subtractor12_output    : out bit_vector (11 downto 0)
47
      );
48
end sub_12bit;
49
 
50
architecture structural of sub_12bit is
51
 
52
   component fulladder
53
      port (
54
      addend        : in   bit;
55
      augend        : in   bit;
56
      carry_in      : in   bit;
57
      sum           : out  bit;
58
      carry         : out  bit
59
      );
60
   end component;
61
 
62
-- internal signal
63
signal c00 : bit;
64
signal c01 : bit;
65
signal c02 : bit;
66
signal c03 : bit;
67
signal c04 : bit;
68
signal c05 : bit;
69
signal c06 : bit;
70
signal c07 : bit;
71
signal c08 : bit;
72
signal c09 : bit;
73
signal c10 : bit;
74
signal c11 : bit;
75
signal c12 : bit;
76
signal augend_12bit    : bit_vector (11 downto 0);
77
signal adder12_output  : bit_vector (11 downto 0);
78
 
79
begin
80
 
81
c00               <= '1'; -- add one to get 2's complement
82
 
83
-- first complement
84
augend_12bit (11) <= not (subtrahend_12bit (11));
85
augend_12bit (10) <= not (subtrahend_12bit (10));
86
augend_12bit (09) <= not (subtrahend_12bit (09));
87
augend_12bit (08) <= not (subtrahend_12bit (08));
88
augend_12bit (07) <= not (subtrahend_12bit (07));
89
augend_12bit (06) <= not (subtrahend_12bit (06));
90
augend_12bit (05) <= not (subtrahend_12bit (05));
91
augend_12bit (04) <= not (subtrahend_12bit (04));
92
augend_12bit (03) <= not (subtrahend_12bit (03));
93
augend_12bit (02) <= not (subtrahend_12bit (02));
94
augend_12bit (01) <= not (subtrahend_12bit (01));
95
augend_12bit (00) <= not (subtrahend_12bit (00));
96
 
97
subtractor12_output <= adder12_output;
98
 
99
fa11 : fulladder
100
   port map (
101
      addend     => addend_12bit(11),
102
      augend     => augend_12bit(11),
103
      carry_in   => c11,
104
      sum        => adder12_output(11),
105
      carry      => c12
106
      );
107
 
108
fa10 : fulladder
109
   port map (
110
      addend     => addend_12bit(10),
111
      augend     => augend_12bit(10),
112
      carry_in   => c10,
113
      sum        => adder12_output(10),
114
      carry      => c11
115
      );
116
 
117
fa09 : fulladder
118
   port map (
119
      addend     => addend_12bit(09),
120
      augend     => augend_12bit(09),
121
      carry_in   => c09,
122
      sum        => adder12_output(09),
123
      carry      => c10
124
      );
125
 
126
fa08 : fulladder
127
   port map (
128
      addend     => addend_12bit(08),
129
      augend     => augend_12bit(08),
130
      carry_in   => c08,
131
      sum        => adder12_output(08),
132
      carry      => c09
133
      );
134
 
135
fa07 : fulladder
136
   port map (
137
      addend     => addend_12bit(07),
138
      augend     => augend_12bit(07),
139
      carry_in   => c07,
140
      sum        => adder12_output(07),
141
      carry      => c08
142
      );
143
 
144
fa06 : fulladder
145
   port map (
146
      addend     => addend_12bit(06),
147
      augend     => augend_12bit(06),
148
      carry_in   => c06,
149
      sum        => adder12_output(06),
150
      carry      => c07
151
      );
152
 
153
fa05 : fulladder
154
   port map (
155
      addend     => addend_12bit(05),
156
      augend     => augend_12bit(05),
157
      carry_in   => c05,
158
      sum        => adder12_output(05),
159
      carry      => c06
160
      );
161
 
162
fa04 : fulladder
163
   port map (
164
      addend     => addend_12bit(04),
165
      augend     => augend_12bit(04),
166
      carry_in   => c04,
167
      sum        => adder12_output(04),
168
      carry      => c05
169
      );
170
 
171
fa03 : fulladder
172
   port map (
173
      addend     => addend_12bit(03),
174
      augend     => augend_12bit(03),
175
      carry_in   => c03,
176
      sum        => adder12_output(03),
177
      carry      => c04
178
      );
179
 
180
fa02 : fulladder
181
   port map (
182
      addend     => addend_12bit(02),
183
      augend     => augend_12bit(02),
184
      carry_in   => c02,
185
      sum        => adder12_output(02),
186
      carry      => c03
187
      );
188
 
189
fa01 : fulladder
190
   port map (
191
      addend     => addend_12bit(01),
192
      augend     => augend_12bit(01),
193
      carry_in   => c01,
194
      sum        => adder12_output(01),
195
      carry      => c02
196
      );
197
 
198
fa00 : fulladder
199
   port map (
200
      addend     => addend_12bit(00),
201
      augend     => augend_12bit(00),
202
      carry_in   => c00,
203
      sum        => adder12_output(00),
204
      carry      => c01
205
      );
206
 
207
end structural;

powered by: WebSVN 2.1.0

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