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

Subversion Repositories keyboardcontroller

[/] [keyboardcontroller/] [tags/] [KEYB_CON_0_01/] [wouter_keyb.vhd] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 wouterw
------------------------------------------------------------------------------
2
-- wouter_keyb.vhd - entity/architecture pair
3
------------------------------------------------------------------------------
4
-- IMPORTANT:
5
-- DO NOT MODIFY THIS FILE EXCEPT IN THE DESIGNATED SECTIONS.
6
--
7
-- SEARCH FOR --USER TO DETERMINE WHERE CHANGES ARE ALLOWED.
8
--
9
-- TYPICALLY, THE ONLY ACCEPTABLE CHANGES INVOLVE ADDING NEW
10
-- PORTS AND GENERICS THAT GET PASSED THROUGH TO THE INSTANTIATION
11
-- OF THE USER_LOGIC ENTITY.
12
------------------------------------------------------------------------------
13
--
14
-- ***************************************************************************
15
-- ** Copyright (c) 1995-2004 Xilinx, Inc.  All rights reserved.            **
16
-- **                                                                       **
17
-- ** Xilinx, Inc.                                                          **
18
-- ** XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"         **
19
-- ** AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND       **
20
-- ** SOLUTIONS FOR XILINX DEVICES.  BY PROVIDING THIS DESIGN, CODE,        **
21
-- ** OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,        **
22
-- ** APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION           **
23
-- ** THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,     **
24
-- ** AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE      **
25
-- ** FOR YOUR IMPLEMENTATION.  XILINX EXPRESSLY DISCLAIMS ANY              **
26
-- ** WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE               **
27
-- ** IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR        **
28
-- ** REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF       **
29
-- ** INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS       **
30
-- ** FOR A PARTICULAR PURPOSE.                                             **
31
-- **                                                                       **
32
-- ** YOU MAY COPY AND MODIFY THESE FILES FOR YOUR OWN INTERNAL USE SOLELY  **
33
-- ** WITH XILINX PROGRAMMABLE LOGIC DEVICES AND XILINX EDK SYSTEM OR       **
34
-- ** CREATE IP MODULES SOLELY FOR XILINX PROGRAMMABLE LOGIC DEVICES AND    **
35
-- ** XILINX EDK SYSTEM. NO RIGHTS ARE GRANTED TO DISTRIBUTE ANY FILES      **
36
-- ** UNLESS THEY ARE DISTRIBUTED IN XILINX PROGRAMMABLE LOGIC DEVICES.     **
37
-- **                                                                       **
38
-- ***************************************************************************
39
--
40
------------------------------------------------------------------------------
41
-- Filename:          wouter_keyb.vhd
42
-- Version:           1.00.a
43
-- Description:       Top level design, instantiates IPIF and user logic.
44
-- Date:              Wed Jun 15 10:21:28 2005 (by Create and Import Peripheral Wizard)
45
-- VHDL-Standard:     VHDL'93
46
------------------------------------------------------------------------------
47
-- Naming Conventions:
48
--      active low signals:                    "*_n"
49
--      clock signals:                         "clk", "clk_div#", "clk_#x"
50
--      reset signals:                         "rst", "rst_n"
51
--      generics:                              "C_*"
52
--      user defined types:                    "*_TYPE"
53
--      state machine next state:              "*_ns"
54
--      state machine current state:           "*_cs"
55
--      combinatorial signals:                 "*_com"
56
--      pipelined or register delay signals:   "*_d#"
57
--      counter signals:                       "*cnt*"
58
--      clock enable signals:                  "*_ce"
59
--      internal version of output port:       "*_i"
60
--      device pins:                           "*_pin"
61
--      ports:                                 "- Names begin with Uppercase"
62
--      processes:                             "*_PROCESS"
63
--      component instantiations:              "<ENTITY_>I_<#|FUNC>"
64
------------------------------------------------------------------------------
65
 
66
library ieee;
67
use ieee.std_logic_1164.all;
68
use ieee.std_logic_arith.all;
69
use ieee.std_logic_unsigned.all;
70
 
71
library proc_common_v2_00_a;
72
use proc_common_v2_00_a.proc_common_pkg.all;
73
use proc_common_v2_00_a.ipif_pkg.all;
74
 
75
library opb_ipif_v3_01_a;
76
use opb_ipif_v3_01_a.all;
77
 
78
--library wouter_keyb_v1_00_a;
79
--use wouter_keyb_v1_00_a.all;
80
library work;
81
use work.Constants.all;
82
 
83
------------------------------------------------------------------------------
84
-- Definition of Generics:
85
--   C_BASEADDR                   -- User logic base address
86
--   C_HIGHADDR                   -- User logic high address
87
--   C_OPB_AWIDTH                 -- OPB address bus width
88
--   C_OPB_DWIDTH                 -- OPB data bus width
89
--   C_FAMILY                     -- Target FPGA architecture
90
--
91
-- Definition of Ports:
92
--   OPB_Clk                      -- OPB Clock
93
--   OPB_Rst                      -- OPB Reset
94
--   Sl_DBus                      -- Slave data bus
95
--   Sl_errAck                    -- Slave error acknowledge
96
--   Sl_retry                     -- Slave retry
97
--   Sl_toutSup                   -- Slave timeout suppress
98
--   Sl_xferAck                   -- Slave transfer acknowledge
99
--   OPB_ABus                     -- OPB address bus
100
--   OPB_BE                       -- OPB byte enable
101
--   OPB_DBus                     -- OPB data bus
102
--   OPB_RNW                      -- OPB read/not write
103
--   OPB_select                   -- OPB select
104
--   OPB_seqAddr                  -- OPB sequential address
105
--
106
--------------------------------------------------------------------------------
107
-- Entity section
108
--------------------------------------------------------------------------------
109
 
110
entity wouter_keyb is
111
        generic
112
        (
113
                -- ADD USER GENERICS BELOW THIS LINE ---------------
114
                --USER generics added here
115
                -- ADD USER GENERICS ABOVE THIS LINE ---------------
116
 
117
                -- DO NOT EDIT BELOW THIS LINE ---------------------
118
                -- Bus protocol parameters, do not add to or delete
119
                C_BASEADDR      : std_logic_vector      := X"00000000";
120
                C_HIGHADDR      : std_logic_vector      := X"0000FFFF";
121
                C_OPB_AWIDTH    : integer       := 32;
122
                C_OPB_DWIDTH    : integer       := 32;
123
                C_FAMILY        : string        := "virtex2p"
124
                -- DO NOT EDIT ABOVE THIS LINE ---------------------
125
        );
126
        port
127
        (
128
                -- ADD USER PORTS BELOW THIS LINE ------------------
129
                keyb_interrupt : out std_logic;
130
                keyb_clk_out : out std_logic;
131
                keyb_cols : in col;
132
                keyb_rows : out row;
133
                keyb_up : out std_logic;
134
 
135
                -- ADD USER PORTS ABOVE THIS LINE ------------------
136
 
137
                -- DO NOT EDIT BELOW THIS LINE ---------------------
138
                -- Bus protocol ports, do not add to or delete
139
                OPB_Clk : in    std_logic;
140
                OPB_Rst : in    std_logic;
141
                Sl_DBus : out   std_logic_vector(0 to C_OPB_DWIDTH-1);
142
                Sl_errAck       : out   std_logic;
143
                Sl_retry        : out   std_logic;
144
                Sl_toutSup      : out   std_logic;
145
                Sl_xferAck      : out   std_logic;
146
                OPB_ABus        : in    std_logic_vector(0 to C_OPB_AWIDTH-1);
147
                OPB_BE  : in    std_logic_vector(0 to C_OPB_DWIDTH/8-1);
148
                OPB_DBus        : in    std_logic_vector(0 to C_OPB_DWIDTH-1);
149
                OPB_RNW : in    std_logic;
150
                OPB_select      : in    std_logic;
151
                OPB_seqAddr     : in    std_logic
152
                -- DO NOT EDIT ABOVE THIS LINE ---------------------
153
        );
154
 
155
        attribute MIN_SIZE : string;
156
        attribute MIN_SIZE of C_BASEADDR : constant is "0x100";
157
 
158
        attribute SIGIS : string;
159
        attribute SIGIS of OPB_Clk : signal is "Clk";
160
        attribute SIGIS of OPB_Rst : signal is "Rst";
161
 
162
end entity wouter_keyb;
163
 
164
--------------------------------------------------------------------------------
165
-- Architecture section
166
--------------------------------------------------------------------------------
167
 
168
architecture IMP of wouter_keyb is
169
 
170
        ----------------------------------------
171
        -- Constant: array of address range identifiers
172
        ----------------------------------------
173
        constant ARD_ID_ARRAY   : INTEGER_ARRAY_TYPE    :=
174
                (
175
 
176
                );
177
 
178
        ----------------------------------------
179
        -- Constant: array of address pairs for each address range
180
        ----------------------------------------
181
        constant ZERO_ADDR_PAD  : std_logic_vector(0 to 64-C_OPB_AWIDTH-1)       := (others => '0');
182
 
183
        constant USER_BASEADDR  : std_logic_vector      := C_BASEADDR;
184
        constant USER_HIGHADDR  : std_logic_vector      := C_HIGHADDR;
185
 
186
        constant ARD_ADDR_RANGE_ARRAY   : SLV64_ARRAY_TYPE      :=
187
                (
188
                        ZERO_ADDR_PAD & USER_BASEADDR,          -- user logic base address
189
                        ZERO_ADDR_PAD & USER_HIGHADDR           -- user logic high address
190
                );
191
 
192
        ----------------------------------------
193
        -- Constant: array of data widths for each target address range
194
        ----------------------------------------
195
        constant USER_DWIDTH    : integer       := 32;
196
 
197
        constant ARD_DWIDTH_ARRAY       : INTEGER_ARRAY_TYPE    :=
198
                (
199
 
200
                );
201
 
202
        ----------------------------------------
203
        -- Constant: array of desired number of chip enables for each address range
204
        ----------------------------------------
205
        constant USER_NUM_CE    : integer       := 1;
206
 
207
        constant ARD_NUM_CE_ARRAY       : INTEGER_ARRAY_TYPE    :=
208
                (
209
 
210
                );
211
 
212
        ----------------------------------------
213
        -- Constant: array of unique properties for each address range
214
        ----------------------------------------
215
        constant ARD_DEPENDENT_PROPS_ARRAY      : DEPENDENT_PROPS_ARRAY_TYPE    :=
216
                (
217
 
218
                );
219
 
220
        ----------------------------------------
221
        -- Constant: pipeline mode
222
        -- 1 = include OPB-In pipeline registers
223
        -- 2 = include IP pipeline registers
224
        -- 3 = include OPB-In and IP pipeline registers
225
        -- 4 = include OPB-Out pipeline registers
226
        -- 5 = include OPB-In and OPB-Out pipeline registers
227
        -- 6 = include IP and OPB-Out pipeline registers
228
        -- 7 = include OPB-In, IP, and OPB-Out pipeline registers
229
        -- Note:
230
        -- only mode 4, 5, 7 are supported for this release
231
        ----------------------------------------
232
        constant PIPELINE_MODEL : integer       := 5;
233
 
234
        ----------------------------------------
235
        -- Constant: user core ID code
236
        ----------------------------------------
237
        constant DEV_BLK_ID     : integer       := 0;
238
 
239
        ----------------------------------------
240
        -- Constant: enable MIR/Reset register
241
        ----------------------------------------
242
        constant DEV_MIR_ENABLE : integer       := 0;
243
 
244
        ----------------------------------------
245
        -- Constant: array of IP interrupt mode
246
        -- 1 = Active-high interrupt condition
247
        -- 2 = Active-low interrupt condition
248
        -- 3 = Active-high pulse interrupt event
249
        -- 4 = Active-low pulse interrupt event
250
        -- 5 = Positive-edge interrupt event
251
        -- 6 = Negative-edge interrupt event
252
        ----------------------------------------
253
        constant IP_INTR_MODE_ARRAY     : INTEGER_ARRAY_TYPE    :=
254
                (
255
 
256
                );
257
 
258
        ----------------------------------------
259
        -- Constant: enable device burst
260
        ----------------------------------------
261
        constant DEV_BURST_ENABLE       : integer       := 0;
262
 
263
        ----------------------------------------
264
        -- Constant: include address counter for burst transfers
265
        ----------------------------------------
266
        constant INCLUDE_ADDR_CNTR      : integer       := 0;
267
 
268
        ----------------------------------------
269
        -- Constant: include write buffer that decouples OPB and IPIC write transactions
270
        ----------------------------------------
271
        constant INCLUDE_WR_BUF : integer       := 0;
272
 
273
        ----------------------------------------
274
        -- Constant: index for CS/CE
275
        ----------------------------------------
276
        constant USER00_CS_INDEX        : integer       := get_id_index(ARD_ID_ARRAY, USER_00);
277
 
278
        constant USER00_CE_INDEX        : integer       := calc_start_ce_index(ARD_NUM_CE_ARRAY, USER00_CS_INDEX);
279
 
280
        ----------------------------------------
281
        -- IP Interconnect (IPIC) signal declarations -- do not delete
282
        ----------------------------------------
283
        signal iBus2IP_RdCE     : std_logic_vector(0 to calc_num_ce(ARD_NUM_CE_ARRAY)-1);
284
        signal iBus2IP_WrCE     : std_logic_vector(0 to calc_num_ce(ARD_NUM_CE_ARRAY)-1);
285
        signal iBus2IP_Data     : std_logic_vector(0 to C_OPB_DWIDTH-1);
286
        signal iBus2IP_BE       : std_logic_vector(0 to C_OPB_DWIDTH/8-1);
287
        signal iIP2Bus_Data     : std_logic_vector(0 to C_OPB_DWIDTH-1)   := (others => '0');
288
        signal iIP2Bus_Ack      : std_logic      := '0';
289
        signal iIP2Bus_Error    : std_logic      := '0';
290
        signal iIP2Bus_Retry    : std_logic      := '0';
291
        signal iIP2Bus_ToutSup  : std_logic      := '0';
292
        signal ZERO_IP2Bus_PostedWrInh  : std_logic_vector(0 to ARD_ID_ARRAY'length-1)    := (others => '0'); -- work around for XST not taking (others => '0') in port mapping
293
        signal ZERO_IP2RFIFO_Data       : std_logic_vector(0 to 31)       := (others => '0'); -- work around for XST not taking (others => '0') in port mapping
294
        signal ZERO_WFIFO2IP_Data       : std_logic_vector(0 to 31)       := (others => '0'); -- work around for XST not taking (others => '0') in port mapping
295
        signal ZERO_IP2Bus_IntrEvent    : std_logic_vector(0 to IP_INTR_MODE_ARRAY'length-1)      := (others => '0'); -- work around for XST not taking (others => '0') in port mapping
296
        signal iBus2IP_Clk      : std_logic;
297
        signal iBus2IP_Reset    : std_logic;
298
        signal uBus2IP_Data     : std_logic_vector(0 to USER_DWIDTH-1);
299
        signal uBus2IP_BE       : std_logic_vector(0 to USER_DWIDTH/8-1);
300
        signal uBus2IP_RdCE     : std_logic_vector(0 to USER_NUM_CE-1);
301
        signal uBus2IP_WrCE     : std_logic_vector(0 to USER_NUM_CE-1);
302
        signal uIP2Bus_Data     : std_logic_vector(0 to USER_DWIDTH-1);
303
 
304
begin
305
 
306
        ----------------------------------------
307
        -- instantiate the OPB IPIF
308
        ----------------------------------------
309
        OPB_IPIF_I : entity opb_ipif_v3_01_a.opb_ipif
310
                generic map
311
                (
312
                        C_ARD_ID_ARRAY => ARD_ID_ARRAY,
313
                        C_ARD_ADDR_RANGE_ARRAY => ARD_ADDR_RANGE_ARRAY,
314
                        C_ARD_DWIDTH_ARRAY => ARD_DWIDTH_ARRAY,
315
                        C_ARD_NUM_CE_ARRAY => ARD_NUM_CE_ARRAY,
316
                        C_ARD_DEPENDENT_PROPS_ARRAY => ARD_DEPENDENT_PROPS_ARRAY,
317
                        C_PIPELINE_MODEL => PIPELINE_MODEL,
318
                        C_DEV_BLK_ID => DEV_BLK_ID,
319
                        C_DEV_MIR_ENABLE => DEV_MIR_ENABLE,
320
                        C_OPB_AWIDTH => C_OPB_AWIDTH,
321
                        C_OPB_DWIDTH => C_OPB_DWIDTH,
322
                        C_FAMILY => C_FAMILY,
323
                        C_IP_INTR_MODE_ARRAY => IP_INTR_MODE_ARRAY,
324
                        C_DEV_BURST_ENABLE => DEV_BURST_ENABLE,
325
                        C_INCLUDE_ADDR_CNTR => INCLUDE_ADDR_CNTR,
326
                        C_INCLUDE_WR_BUF => INCLUDE_WR_BUF
327
                )
328
                port map
329
                (
330
                        OPB_select => OPB_select,
331
                        OPB_DBus => OPB_DBus,
332
                        OPB_ABus => OPB_ABus,
333
                        OPB_BE => OPB_BE,
334
                        OPB_RNW => OPB_RNW,
335
                        OPB_seqAddr => OPB_seqAddr,
336
                        Sln_DBus => Sl_DBus,
337
                        Sln_xferAck => Sl_xferAck,
338
                        Sln_errAck => Sl_errAck,
339
                        Sln_retry => Sl_retry,
340
                        Sln_toutSup => Sl_toutSup,
341
                        Bus2IP_CS => open,
342
                        Bus2IP_CE => open,
343
                        Bus2IP_RdCE => iBus2IP_RdCE,
344
                        Bus2IP_WrCE => iBus2IP_WrCE,
345
                        Bus2IP_Data => iBus2IP_Data,
346
                        Bus2IP_Addr => open,
347
                        Bus2IP_AddrValid => open,
348
                        Bus2IP_BE => iBus2IP_BE,
349
                        Bus2IP_RNW => open,
350
                        Bus2IP_Burst => open,
351
                        IP2Bus_Data => iIP2Bus_Data,
352
                        IP2Bus_Ack => iIP2Bus_Ack,
353
                        IP2Bus_AddrAck => '0',
354
                        IP2Bus_Error => iIP2Bus_Error,
355
                        IP2Bus_Retry => iIP2Bus_Retry,
356
                        IP2Bus_ToutSup => iIP2Bus_ToutSup,
357
                        IP2Bus_PostedWrInh => ZERO_IP2Bus_PostedWrInh,
358
                        IP2RFIFO_Data => ZERO_IP2RFIFO_Data,
359
                        IP2RFIFO_WrMark => '0',
360
                        IP2RFIFO_WrRelease => '0',
361
                        IP2RFIFO_WrReq => '0',
362
                        IP2RFIFO_WrRestore => '0',
363
                        RFIFO2IP_AlmostFull => open,
364
                        RFIFO2IP_Full => open,
365
                        RFIFO2IP_Vacancy => open,
366
                        RFIFO2IP_WrAck => open,
367
                        IP2WFIFO_RdMark => '0',
368
                        IP2WFIFO_RdRelease => '0',
369
                        IP2WFIFO_RdReq => '0',
370
                        IP2WFIFO_RdRestore => '0',
371
                        WFIFO2IP_AlmostEmpty => open,
372
                        WFIFO2IP_Data => ZERO_WFIFO2IP_Data,
373
                        WFIFO2IP_Empty => open,
374
                        WFIFO2IP_Occupancy => open,
375
                        WFIFO2IP_RdAck => open,
376
                        IP2Bus_IntrEvent => ZERO_IP2Bus_IntrEvent,
377
                        IP2INTC_Irpt => open,
378
                        Freeze => '0',
379
                        Bus2IP_Freeze => open,
380
                        OPB_Clk => OPB_Clk,
381
                        Bus2IP_Clk => iBus2IP_Clk,
382
                        IP2Bus_Clk => '0',
383
                        Reset => OPB_Rst,
384
                        Bus2IP_Reset => iBus2IP_Reset
385
                );
386
 
387
        ----------------------------------------
388
        -- instantiate the User Logic
389
        ----------------------------------------
390
        USER_LOGIC_I : entity wouter_keyb_v1_00_a.user_logic
391
                generic map
392
                (
393
                        -- MAP USER GENERICS BELOW THIS LINE ---------------
394
                        --USER generics mapped here
395
                        -- MAP USER GENERICS ABOVE THIS LINE ---------------
396
 
397
                        C_DWIDTH => USER_DWIDTH,
398
                        C_NUM_CE => USER_NUM_CE
399
                )
400
                port map
401
                (
402
                        -- MAP USER PORTS BELOW THIS LINE ------------------
403
                        keyb_interrupt,
404
                        keyb_clk_out,
405
                        keyb_cols,
406
                        keyb_rows,
407
                        keyb_up,
408
                        -- MAP USER PORTS ABOVE THIS LINE ------------------
409
 
410
                        Bus2IP_Clk => iBus2IP_Clk,
411
                        Bus2IP_Reset => iBus2IP_Reset,
412
                        Bus2IP_Data => uBus2IP_Data,
413
                        Bus2IP_BE => uBus2IP_BE,
414
                        Bus2IP_RdCE => uBus2IP_RdCE,
415
                        Bus2IP_WrCE => uBus2IP_WrCE,
416
                        IP2Bus_Data => uIP2Bus_Data,
417
                        IP2Bus_Ack => iIP2Bus_Ack,
418
                        IP2Bus_Retry => iIP2Bus_Retry,
419
                        IP2Bus_Error => iIP2Bus_Error,
420
                        IP2Bus_ToutSup => iIP2Bus_ToutSup
421
                );
422
 
423
        ----------------------------------------
424
        -- hooking up signal slicing
425
        ----------------------------------------
426
        uBus2IP_BE <= iBus2IP_BE(0 to USER_DWIDTH/8-1);
427
        uBus2IP_Data <= iBus2IP_Data(0 to USER_DWIDTH-1);
428
        uBus2IP_RdCE <= iBus2IP_RdCE(USER00_CE_INDEX to USER00_CE_INDEX+USER_NUM_CE-1);
429
        uBus2IP_WrCE <= iBus2IP_WrCE(USER00_CE_INDEX to USER00_CE_INDEX+USER_NUM_CE-1);
430
        iIP2Bus_Data(0 to USER_DWIDTH-1) <= uIP2Bus_Data;
431
 
432
end IMP;

powered by: WebSVN 2.1.0

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