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

Subversion Repositories modular_oscilloscope

[/] [modular_oscilloscope/] [trunk/] [hdl/] [ctrl/] [generic_decoder.vhd] - Blame information for rev 42

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

Line No. Rev Author Line
1 32 budinero
-------------------------------------------------------------------------------------------------100
2
--| Modular Oscilloscope
3
--| UNSL - Argentine
4
--|
5
--| File: generic_decoder.vhd
6
--| Version: 0.1
7
--| Tested in: Actel A3PE1500
8
--|   Board: RVI Prototype Board + LP Data Conversion Daughter Board
9
--|-------------------------------------------------------------------------------------------------
10
--| Description:
11
--|   CONTROL - Decoder
12
--|   This is a simple decoder
13
--|   
14
--|-------------------------------------------------------------------------------------------------
15
--| File history:
16
--|   0.1   | jul-2009 | First release
17
--|   0.2   | jul-2009 | New output code
18
----------------------------------------------------------------------------------------------------
19 33 budinero
--| Copyright © 2009, Facundo Aguilera.
20 32 budinero
--|
21
--| This VHDL design file is an open design; you can redistribute it and/or
22
--| modify it and/or implement it after contacting the author.
23
----------------------------------------------------------------------------------------------------
24
 
25
 
26
-- NOTE: Look at the end for comparisons between the SmartGen decoder and this decoder.
27
--       If you are using an Actel's FPGA, you may want to use the SmartGen decoder.
28
 
29
 
30
-- Example for 3 bits
31
-- Input    Output
32
-- 000      00000001
33
-- 001      00000011
34
-- 010      00000111
35
-- 011      00001111
36
-- 100      00011111
37
-- 101      00111111
38
-- 110      01111111
39
-- 111      11111111
40
--                  
41
 
42
--==================================================================================================
43
-- TODO
44
-- · ...
45
--==================================================================================================
46
 
47
 
48
library IEEE;
49
use ieee.std_logic_1164.all;
50
use IEEE.NUMERIC_STD.ALL;
51
use ieee.math_real.all;
52
 
53
entity generic_decoder is
54
  generic(
55
    INPUT_WIDTH: integer := 5 -- Input with for decoder (decodes INPUT_WIDTH to 2^INPUT_WIDTH)
56
  );
57
  Port(
58
    enable_I:   in std_logic;
59
    data_I:     in std_logic_vector(INPUT_WIDTH-1 downto 0);
60
    decoded_O:  out std_logic_vector( integer(2**real(INPUT_WIDTH))-1  downto 0)
61
  );
62
end entity generic_decoder;
63
 
64
architecture beh of generic_decoder is
65
 
66
begin
67
 
68 37 budinero
  P_main: process (data_I, enable_I)
69 32 budinero
    variable i: integer range 0 to decoded_O'length-1;
70
  begin
71
    for i in 0 to decoded_O'length-1 loop
72
      if i <= to_integer(unsigned(data_I)) and enable_I = '1' then
73
        decoded_O(i) <= '1';
74
      else
75
        decoded_O(i) <= '0';
76
      end if;
77
    end loop;
78
 
79
  end process;
80
 
81
 
82
end architecture;
83
 
84
 
85
 
86
 
87
--================================================================================================--
88
-- SYNPLIFY REPORT for this decoder (INPUT_WIDTH := 5)
89
--
90
-- Report for cell generic_decoder.beh
91
--   Core Cell usage:
92
--               cell count     area count*area
93
--                AO1     1      1.0        1.0
94
--                GND     1      0.0        0.0
95
--              NOR2B    11      1.0       11.0
96
--              NOR3C     1      1.0        1.0
97
--                OA1    22      1.0       22.0
98
--                OR2     3      1.0        3.0
99
--                VCC     1      0.0        0.0
100
-- 
101
-- 
102
--                    -----          ----------
103
--              TOTAL    40                38.0
104
-- 
105
-- 
106
--   IO Cell usage:
107
--               cell count
108
--              INBUF     6
109
--             OUTBUF    32
110
--                    -----
111
--              TOTAL    38
112
-- 
113
-- 
114
-- Core Cells         : 38 of 38400 (0%)
115
-- IO Cells           : 38
116
--
117
--================================================================================================--
118
-- Designer timing report SUMMARY (Auto layout, without constraints)
119
-- 
120
--                             Input to Output
121
-- Min Delay (ns):             2.770 
122
-- Max Delay (ns):             16     
123
--================================================================================================--
124
 
125
 
126
 
127
 
128
 
129
 
130
----------------------------------------------------------------------------------------------------
131
-- SmartGen decoder5to32
132
 
133
-- -- Version: 8.5 SP1 8.5.1.13
134
-- 
135
-- library ieee;
136
-- use ieee.std_logic_1164.all;
137
-- library proasic3e;
138
-- use proasic3e.all;
139
-- 
140
-- entity decoder5to32 is 
141
--     port(Data0, Data1, Data2, Data3, Data4 : in std_logic; Eq : 
142
--         out std_logic_vector(31 downto 0)) ;
143
-- end decoder5to32;
144
-- 
145
-- 
146
-- architecture DEF_ARCH of  decoder5to32 is
147
-- 
148
--     component AND2
149
--         port(A, B : in std_logic := 'U'; Y : out std_logic) ;
150
--     end component;
151
-- 
152
--     component AND2A
153
--         port(A, B : in std_logic := 'U'; Y : out std_logic) ;
154
--     end component;
155
-- 
156
--     component AND3C
157
--         port(A, B, C : in std_logic := 'U'; Y : out std_logic) ;
158
--     end component;
159
-- 
160
--     component AND3
161
--         port(A, B, C : in std_logic := 'U'; Y : out std_logic) ;
162
--     end component;
163
-- 
164
--     component AND3A
165
--         port(A, B, C : in std_logic := 'U'; Y : out std_logic) ;
166
--     end component;
167
-- 
168
--     component AND3B
169
--         port(A, B, C : in std_logic := 'U'; Y : out std_logic) ;
170
--     end component;
171
-- 
172
--     component NOR2
173
--         port(A, B : in std_logic := 'U'; Y : out std_logic) ;
174
--     end component;
175
-- 
176
--     signal AND3C_0_Y, AND3B_2_Y, AND3B_1_Y, AND3A_0_Y, AND3B_0_Y, 
177
--         AND3A_1_Y, AND3A_2_Y, AND3_0_Y, NOR2_0_Y, AND2A_1_Y, 
178
--         AND2A_0_Y, AND2_0_Y : std_logic ;
179
--     begin   
180
-- 
181
--     AND2_Eq_5_inst : AND2
182
--       port map(A => AND3A_1_Y, B => NOR2_0_Y, Y => Eq(5));
183
--     AND2_Eq_2_inst : AND2
184
--       port map(A => AND3B_1_Y, B => NOR2_0_Y, Y => Eq(2));
185
--     AND2_0 : AND2
186
--       port map(A => Data4, B => Data3, Y => AND2_0_Y);
187
--     AND2_Eq_28_inst : AND2
188
--       port map(A => AND3B_0_Y, B => AND2_0_Y, Y => Eq(28));
189
--     AND2_Eq_10_inst : AND2
190
--       port map(A => AND3B_1_Y, B => AND2A_1_Y, Y => Eq(10));
191
--     AND2_Eq_19_inst : AND2
192
--       port map(A => AND3A_0_Y, B => AND2A_0_Y, Y => Eq(19));
193
--     AND2_Eq_21_inst : AND2
194
--       port map(A => AND3A_1_Y, B => AND2A_0_Y, Y => Eq(21));
195
--     AND2A_1 : AND2A
196
--       port map(A => Data4, B => Data3, Y => AND2A_1_Y);
197
--     AND2_Eq_14_inst : AND2
198
--       port map(A => AND3A_2_Y, B => AND2A_1_Y, Y => Eq(14));
199
--     AND3C_0 : AND3C
200
--       port map(A => Data2, B => Data1, C => Data0, Y => AND3C_0_Y);
201
--     AND2_Eq_31_inst : AND2
202
--       port map(A => AND3_0_Y, B => AND2_0_Y, Y => Eq(31));
203
--     AND2_Eq_1_inst : AND2
204
--       port map(A => AND3B_2_Y, B => NOR2_0_Y, Y => Eq(1));
205
--     AND2_Eq_16_inst : AND2
206
--       port map(A => AND3C_0_Y, B => AND2A_0_Y, Y => Eq(16));
207
--     AND3_0 : AND3
208
--       port map(A => Data2, B => Data1, C => Data0, Y => AND3_0_Y);
209
--     AND2_Eq_23_inst : AND2
210
--       port map(A => AND3_0_Y, B => AND2A_0_Y, Y => Eq(23));
211
--     AND2_Eq_9_inst : AND2
212
--       port map(A => AND3B_2_Y, B => AND2A_1_Y, Y => Eq(9));
213
--     AND2_Eq_22_inst : AND2
214
--       port map(A => AND3A_2_Y, B => AND2A_0_Y, Y => Eq(22));
215
--     AND2_Eq_6_inst : AND2
216
--       port map(A => AND3A_2_Y, B => NOR2_0_Y, Y => Eq(6));
217
--     AND2_Eq_8_inst : AND2
218
--       port map(A => AND3C_0_Y, B => AND2A_1_Y, Y => Eq(8));
219
--     AND2_Eq_18_inst : AND2
220
--       port map(A => AND3B_1_Y, B => AND2A_0_Y, Y => Eq(18));
221
--     AND2_Eq_25_inst : AND2
222
--       port map(A => AND3B_2_Y, B => AND2_0_Y, Y => Eq(25));
223
--     AND3A_2 : AND3A
224
--       port map(A => Data0, B => Data1, C => Data2, Y => AND3A_2_Y);
225
--     AND2_Eq_27_inst : AND2
226
--       port map(A => AND3A_0_Y, B => AND2_0_Y, Y => Eq(27));
227
--     AND2_Eq_7_inst : AND2
228
--       port map(A => AND3_0_Y, B => NOR2_0_Y, Y => Eq(7));
229
--     AND2_Eq_11_inst : AND2
230
--       port map(A => AND3A_0_Y, B => AND2A_1_Y, Y => Eq(11));
231
--     AND3A_1 : AND3A
232
--       port map(A => Data1, B => Data2, C => Data0, Y => AND3A_1_Y);
233
--     AND2_Eq_0_inst : AND2
234
--       port map(A => AND3C_0_Y, B => NOR2_0_Y, Y => Eq(0));
235
--     AND2_Eq_3_inst : AND2
236
--       port map(A => AND3A_0_Y, B => NOR2_0_Y, Y => Eq(3));
237
--     AND2_Eq_12_inst : AND2
238
--       port map(A => AND3B_0_Y, B => AND2A_1_Y, Y => Eq(12));
239
--     AND2_Eq_13_inst : AND2
240
--       port map(A => AND3A_1_Y, B => AND2A_1_Y, Y => Eq(13));
241
--     AND2A_0 : AND2A
242
--       port map(A => Data3, B => Data4, Y => AND2A_0_Y);
243
--     AND3B_1 : AND3B
244
--       port map(A => Data2, B => Data0, C => Data1, Y => AND3B_1_Y);
245
--     AND3B_0 : AND3B
246
--       port map(A => Data0, B => Data1, C => Data2, Y => AND3B_0_Y);
247
--     AND2_Eq_17_inst : AND2
248
--       port map(A => AND3B_2_Y, B => AND2A_0_Y, Y => Eq(17));
249
--     AND2_Eq_15_inst : AND2
250
--       port map(A => AND3_0_Y, B => AND2A_1_Y, Y => Eq(15));
251
--     AND2_Eq_20_inst : AND2
252
--       port map(A => AND3B_0_Y, B => AND2A_0_Y, Y => Eq(20));
253
--     AND2_Eq_29_inst : AND2
254
--       port map(A => AND3A_1_Y, B => AND2_0_Y, Y => Eq(29));
255
--     NOR2_0 : NOR2
256
--       port map(A => Data4, B => Data3, Y => NOR2_0_Y);
257
--     AND3B_2 : AND3B
258
--       port map(A => Data2, B => Data1, C => Data0, Y => AND3B_2_Y);
259
--     AND2_Eq_4_inst : AND2
260
--       port map(A => AND3B_0_Y, B => NOR2_0_Y, Y => Eq(4));
261
--     AND2_Eq_24_inst : AND2
262
--       port map(A => AND3C_0_Y, B => AND2_0_Y, Y => Eq(24));
263
--     AND3A_0 : AND3A
264
--       port map(A => Data2, B => Data1, C => Data0, Y => AND3A_0_Y);
265
--     AND2_Eq_26_inst : AND2
266
--       port map(A => AND3B_1_Y, B => AND2_0_Y, Y => Eq(26));
267
--     AND2_Eq_30_inst : AND2
268
--       port map(A => AND3A_2_Y, B => AND2_0_Y, Y => Eq(30));
269
-- end DEF_ARCH;
270
 
271
--================================================================================================--
272
-- SYNPLIFY REPORT for SmartGen decoder
273
-- 
274
-- Report for cell decoder5to32.def_arch
275
--   Core Cell usage:
276
--               cell count     area count*area
277
--               AND2    33      1.0       33.0  Too many ands!
278
--              AND2A     2      1.0        2.0
279
--               AND3     1      1.0        1.0
280
--              AND3A     3      1.0        3.0
281
--              AND3B     3      1.0        3.0
282
--              AND3C     1      1.0        1.0
283
--                GND     1      0.0        0.0
284
--               NOR2     1      1.0        1.0
285
--                VCC     1      0.0        0.0
286
-- 
287
-- 
288
--                    ---          ----------
289
--              TOTAL    46                44.0
290
-- 
291
-- 
292
--   IO Cell usage:
293
--               cell count
294
--              INBUF     5
295
--             OUTBUF    32
296
--                    ---
297
--              TOTAL    37
298
-- 
299
-- 
300
-- Core Cells         : 44 of 38400 (0%)
301
-- IO Cells           : 37
302
--
303
--================================================================================================--
304
-- Designer timing report SUMMARY (Auto layout, without constraints)
305
-- SUMMARY
306
-- 
307
--                             Input to Output
308
-- Min Delay (ns):             3.087 
309
-- Max Delay (ns):             17 
310
--================================================================================================--

powered by: WebSVN 2.1.0

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