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 38

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

powered by: WebSVN 2.1.0

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