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

Subversion Repositories simple_fm_receiver

[/] [simple_fm_receiver/] [tags/] [VSFR_1/] [source/] [sub_12bit.vhdl] - Blame information for rev 32

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 arif_endro
-- $Id: sub_12bit.vhdl,v 1.1.1.1 2005-01-04 02:05:58 arif_endro Exp $
2
-------------------------------------------------------------------------------
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
-- Simulators  : Modelsim 6.0
11
-- Synthesizers: 
12
-- Target      : 
13
-------------------------------------------------------------------------------
14
-- Description : Subtractor 12 bit used in loop filter
15
-------------------------------------------------------------------------------
16
-- Copyright (c) 2004 Arif E. Nugroho
17
-- 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
 
21
library IEEE;
22
use IEEE.STD_LOGIC_1164.ALL;
23
use IEEE.STD_LOGIC_arith.ALL;
24
 
25
entity sub_12bit is
26
   port (
27
      addend_12bit           : in  bit_vector (11 downto 0);
28
      subtrahend_12bit       : in  bit_vector (11 downto 0);
29
      subtractor12_output    : out bit_vector (11 downto 0)
30
      );
31
end sub_12bit;
32
 
33
architecture structural of sub_12bit is
34
 
35
   component fulladder
36
      port (
37
      addend        : in   bit;
38
      augend        : in   bit;
39
      carry_in      : in   bit;
40
      sum           : out  bit;
41
      carry         : out  bit
42
      );
43
   end component;
44
 
45
-- internal signal
46
signal c00 : bit;
47
signal c01 : bit;
48
signal c02 : bit;
49
signal c03 : bit;
50
signal c04 : bit;
51
signal c05 : bit;
52
signal c06 : bit;
53
signal c07 : bit;
54
signal c08 : bit;
55
signal c09 : bit;
56
signal c10 : bit;
57
signal c11 : bit;
58
signal c12 : bit;
59
signal augend_12bit    : bit_vector (11 downto 0);
60
signal adder12_output  : bit_vector (11 downto 0);
61
 
62
begin
63
 
64
c00               <= '1'; -- add one to get 2's complement
65
 
66
-- first complement
67
augend_12bit (11) <= not (subtrahend_12bit (11));
68
augend_12bit (10) <= not (subtrahend_12bit (10));
69
augend_12bit (09) <= not (subtrahend_12bit (09));
70
augend_12bit (08) <= not (subtrahend_12bit (08));
71
augend_12bit (07) <= not (subtrahend_12bit (07));
72
augend_12bit (06) <= not (subtrahend_12bit (06));
73
augend_12bit (05) <= not (subtrahend_12bit (05));
74
augend_12bit (04) <= not (subtrahend_12bit (04));
75
augend_12bit (03) <= not (subtrahend_12bit (03));
76
augend_12bit (02) <= not (subtrahend_12bit (02));
77
augend_12bit (01) <= not (subtrahend_12bit (01));
78
augend_12bit (00) <= not (subtrahend_12bit (00));
79
 
80
subtractor12_output <= adder12_output;
81
 
82
fa11 : fulladder
83
   port map (
84
      addend     => addend_12bit(11),
85
      augend     => augend_12bit(11),
86
      carry_in   => c11,
87
      sum        => adder12_output(11),
88
      carry      => c12
89
      );
90
 
91
fa10 : fulladder
92
   port map (
93
      addend     => addend_12bit(10),
94
      augend     => augend_12bit(10),
95
      carry_in   => c10,
96
      sum        => adder12_output(10),
97
      carry      => c11
98
      );
99
 
100
fa09 : fulladder
101
   port map (
102
      addend     => addend_12bit(09),
103
      augend     => augend_12bit(09),
104
      carry_in   => c09,
105
      sum        => adder12_output(09),
106
      carry      => c10
107
      );
108
 
109
fa08 : fulladder
110
   port map (
111
      addend     => addend_12bit(08),
112
      augend     => augend_12bit(08),
113
      carry_in   => c08,
114
      sum        => adder12_output(08),
115
      carry      => c09
116
      );
117
 
118
fa07 : fulladder
119
   port map (
120
      addend     => addend_12bit(07),
121
      augend     => augend_12bit(07),
122
      carry_in   => c07,
123
      sum        => adder12_output(07),
124
      carry      => c08
125
      );
126
 
127
fa06 : fulladder
128
   port map (
129
      addend     => addend_12bit(06),
130
      augend     => augend_12bit(06),
131
      carry_in   => c06,
132
      sum        => adder12_output(06),
133
      carry      => c07
134
      );
135
 
136
fa05 : fulladder
137
   port map (
138
      addend     => addend_12bit(05),
139
      augend     => augend_12bit(05),
140
      carry_in   => c05,
141
      sum        => adder12_output(05),
142
      carry      => c06
143
      );
144
 
145
fa04 : fulladder
146
   port map (
147
      addend     => addend_12bit(04),
148
      augend     => augend_12bit(04),
149
      carry_in   => c04,
150
      sum        => adder12_output(04),
151
      carry      => c05
152
      );
153
 
154
fa03 : fulladder
155
   port map (
156
      addend     => addend_12bit(03),
157
      augend     => augend_12bit(03),
158
      carry_in   => c03,
159
      sum        => adder12_output(03),
160
      carry      => c04
161
      );
162
 
163
fa02 : fulladder
164
   port map (
165
      addend     => addend_12bit(02),
166
      augend     => augend_12bit(02),
167
      carry_in   => c02,
168
      sum        => adder12_output(02),
169
      carry      => c03
170
      );
171
 
172
fa01 : fulladder
173
   port map (
174
      addend     => addend_12bit(01),
175
      augend     => augend_12bit(01),
176
      carry_in   => c01,
177
      sum        => adder12_output(01),
178
      carry      => c02
179
      );
180
 
181
fa00 : fulladder
182
   port map (
183
      addend     => addend_12bit(00),
184
      augend     => augend_12bit(00),
185
      carry_in   => c00,
186
      sum        => adder12_output(00),
187
      carry      => c01
188
      );
189
 
190
end structural;

powered by: WebSVN 2.1.0

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