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

Subversion Repositories dirac

[/] [dirac/] [trunk/] [src/] [encoder/] [FOLLOW_COUNTER.vhd] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 petebleack
-- ***** BEGIN LICENSE BLOCK *****
2
-- 
3
-- $Id: FOLLOW_COUNTER.vhd,v 1.1.1.1 2005-03-30 10:09:49 petebleackley Exp $ $Name: not supported by cvs2svn $
4
-- *
5
-- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6
-- *
7
-- * The contents of this file are subject to the Mozilla Public License
8
-- * Version 1.1 (the "License"); you may not use this file except in compliance
9
-- * with the License. You may obtain a copy of the License at
10
-- * http://www.mozilla.org/MPL/
11
-- *
12
-- * Software distributed under the License is distributed on an "AS IS" basis,
13
-- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
14
-- * the specific language governing rights and limitations under the License.
15
-- *
16
-- * The Original Code is BBC Research and Development code.
17
-- *
18
-- * The Initial Developer of the Original Code is the British Broadcasting
19
-- * Corporation.
20
-- * Portions created by the Initial Developer are Copyright (C) 2004.
21
-- * All Rights Reserved.
22
-- *
23
-- * Contributor(s): Peter Bleackley (Original author)
24
-- *
25
-- * Alternatively, the contents of this file may be used under the terms of
26
-- * the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
27
-- * Public License Version 2.1 (the "LGPL"), in which case the provisions of
28
-- * the GPL or the LGPL are applicable instead of those above. If you wish to
29
-- * allow use of your version of this file only under the terms of the either
30
-- * the GPL or LGPL and not to allow others to use your version of this file
31
-- * under the MPL, indicate your decision by deleting the provisions above
32
-- * and replace them with the notice and other provisions required by the GPL
33
-- * or LGPL. If you do not delete the provisions above, a recipient may use
34
-- * your version of this file under the terms of any one of the MPL, the GPL
35
-- * or the LGPL.
36
-- * ***** END LICENSE BLOCK ***** */
37
 
38
library IEEE;
39
use IEEE.STD_LOGIC_1164.ALL;
40
use IEEE.STD_LOGIC_ARITH.ALL;
41
use IEEE.STD_LOGIC_UNSIGNED.ALL;
42
 
43
--  Uncomment the following lines to use the declarations that are
44
--  provided for instantiating Xilinx primitive components.
45
--library UNISIM;
46
--use UNISIM.VComponents.all;
47
 
48
entity FOLLOW_COUNTER is
49
    Port ( INCREMENT : in std_logic;
50
           TEST : in std_logic;
51
                          RESET : in std_logic;
52
           CLOCK : in std_logic;
53
           OUTPUT : out std_logic);
54
end FOLLOW_COUNTER;
55
 
56
architecture RTL of FOLLOW_COUNTER is
57
        component COUNT_UNIT
58
        port(INCREMENT: in std_logic;
59
        DECREMENT:      in std_logic;
60
        RESET : in std_logic;
61
        CLOCK:  in std_logic;
62
        OUTPUT: out std_logic;
63
        INCREMENT_CARRY: out std_logic;
64
        DECREMENT_CARRY: out std_logic);
65
        end component COUNT_UNIT;
66
        signal A,B,C,D,E,F,G,H: std_logic;
67
        signal AB,CD,EF,GH:     std_logic;
68
        signal AD,EH:   std_logic;
69
        signal NONZERO: std_logic;
70
        signal INC0,INC1,INC2,INC3,INC4,INC5,INC6,INC7: std_logic;
71
        signal DEC0,DEC1,DEC2,DEC3,DEC4,DEC5,DEC6,DEC7: std_logic;
72
        signal DECREMENT:       std_logic;
73
begin
74
 
75
-- detect non-zero result
76
 
77
        AB <= A or B;
78
        CD <= C or D;
79
        EF <= E or F;
80
        GH <= G or H;
81
 
82
        AD <= AB or CD;
83
        EH <= EF or GH;
84
 
85
        NONZERO <=      AD or EH;
86
 
87
-- Output
88
 
89
        OUTPUT <= DECREMENT;
90
 
91
-- Feedback
92
 
93
        DECREMENT <= TEST and NONZERO;
94
 
95
-- Sequential arithmetic
96
 
97
COUNT0: COUNT_UNIT
98
        port map(INCREMENT => INCREMENT,
99
        DECREMENT => DECREMENT,
100
        RESET => RESET,
101
        CLOCK => CLOCK,
102
        OUTPUT => A,
103
        INCREMENT_CARRY => INC0,
104
        DECREMENT_CARRY => DEC0);
105
 
106
COUNT1: COUNT_UNIT
107
        port map(INCREMENT => INC0,
108
        DECREMENT => DEC0,
109
        RESET => RESET,
110
        CLOCK => CLOCK,
111
        OUTPUT => B,
112
        INCREMENT_CARRY => INC1,
113
        DECREMENT_CARRY => DEC1);
114
 
115
COUNT2: COUNT_UNIT
116
        port map(INCREMENT => INC1,
117
        DECREMENT => DEC1,
118
        RESET => RESET,
119
        CLOCK => CLOCK,
120
        OUTPUT => C,
121
        INCREMENT_CARRY => INC2,
122
        DECREMENT_CARRY => DEC2);
123
 
124
COUNT3: COUNT_UNIT
125
        port map(INCREMENT => INC2,
126
        DECREMENT => DEC2,
127
        RESET => RESET,
128
        CLOCK => CLOCK,
129
        OUTPUT => D,
130
        INCREMENT_CARRY => INC3,
131
        DECREMENT_CARRY => DEC3);
132
 
133
COUNT4: COUNT_UNIT
134
        port map(INCREMENT => INC3,
135
        DECREMENT => DEC3,
136
        RESET => RESET,
137
        CLOCK => CLOCK,
138
        OUTPUT => E,
139
        INCREMENT_CARRY => INC4,
140
        DECREMENT_CARRY => DEC4);
141
 
142
COUNT5: COUNT_UNIT
143
        port map(INCREMENT => INC4,
144
        DECREMENT => DEC4,
145
        RESET => RESET,
146
        CLOCK => CLOCK,
147
        OUTPUT => F,
148
        INCREMENT_CARRY => INC5,
149
        DECREMENT_CARRY => DEC5);
150
 
151
COUNT6: COUNT_UNIT
152
        port map(INCREMENT => INC5,
153
        DECREMENT => DEC5,
154
        RESET => RESET,
155
        CLOCK => CLOCK,
156
        OUTPUT => G,
157
        INCREMENT_CARRY => INC6,
158
        DECREMENT_CARRY => DEC6);
159
 
160
COUNT7: COUNT_UNIT
161
        port map(INCREMENT => INC6,
162
        DECREMENT => DEC6,
163
        RESET => RESET,
164
        CLOCK => CLOCK,
165
        OUTPUT => H,
166
        INCREMENT_CARRY => INC7,
167
        DECREMENT_CARRY => DEC7);
168
 
169
 
170
end RTL;

powered by: WebSVN 2.1.0

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