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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.6/] [rtl/] [vlib/] [xlib/] [iob_reg_io_gen.vhd] - Blame information for rev 27

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

Line No. Rev Author Line
1 13 wfjm
-- $Id: iob_reg_io_gen.vhd 427 2011-11-19 21:04:11Z mueller $
2 2 wfjm
--
3
-- Copyright 2007-2008 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
--
5
-- This program is free software; you may redistribute and/or modify it under
6
-- the terms of the GNU General Public License as published by the Free
7
-- Software Foundation, either version 2, or at your option any later version.
8
--
9
-- This program is distributed in the hope that it will be useful, but
10
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
-- for complete details.
13
--
14
------------------------------------------------------------------------------
15
-- Module Name:    iob_reg_io_gen - syn
16
-- Description:    Registered IOB, in/output, vector
17
--
18
-- Dependencies:   iob_keeper_gen                 [sim only]
19
-- Test bench:     -
20
-- Target Devices: generic Spartan, Virtex
21 13 wfjm
-- Tool versions:  xst 8.2, 9.1, 9.2, 13.1; ghdl 0.18-0.29
22 2 wfjm
-- Revision History: 
23
-- Date         Rev Version  Comment
24
-- 2008-05-22   149   1.0.4  use internally TE to match OBUFT T polarity
25
-- 2008-05-22   148   1.0.3  remove UNISIM prim's; PULL implemented only for sim
26
-- 2008-05-18   147   1.0.2  add PULL generic, to enable PULL-UP,-DOWN or KEEPER
27
-- 2007-12-16   101   1.0.1  add INIT generic ports
28
-- 2007-12-08   100   1.0    Initial version 
29
------------------------------------------------------------------------------
30
 
31
library ieee;
32
use ieee.std_logic_1164.all;
33
 
34
use work.slvtypes.all;
35
use work.xlib.all;
36
 
37
entity iob_reg_io_gen is                -- registered IOB, in/output, vector
38
  generic (
39
    DWIDTH : positive := 16;            -- data port width
40
    INITI : slbit := '0';               -- initial state ( in flop)
41
    INITO : slbit := '0';               -- initial state (out flop)
42
    INITE : slbit := '0';               -- initial state ( oe flop)
43
    PULL : string := "NONE");           -- pull-up,-down or keeper
44
  port (
45
    CLK  : in slbit;                    -- clock
46
    CEI  : in slbit := '1';             -- clock enable ( in flops)
47
    CEO  : in slbit := '1';             -- clock enable (out flops)
48
    OE   : in slbit;                    -- output enable
49
    DI   : out slv(DWIDTH-1 downto 0);  -- input data   (read from pad)
50
    DO   : in slv(DWIDTH-1 downto 0);   -- output data  (write  to pad)
51
    PAD  : inout slv(DWIDTH-1 downto 0) -- i/o pad
52
  );
53
end iob_reg_io_gen;
54
 
55
 
56
architecture syn of iob_reg_io_gen is
57
 
58
  signal R_TE  : slbit := not INITE;
59
  signal R_DI  : slv(DWIDTH-1 downto 0) := (others=>INITI);
60
  signal R_DO  : slv(DWIDTH-1 downto 0) := (others=>INITO);
61
 
62
  constant all_z : slv(DWIDTH-1 downto 0) := (others=>'Z');
63
  constant all_l : slv(DWIDTH-1 downto 0) := (others=>'L');
64
  constant all_h : slv(DWIDTH-1 downto 0) := (others=>'H');
65
 
66
  attribute iob : string;
67
  attribute iob of R_TE : signal is "true";
68
  attribute iob of R_DI : signal is "true";
69
  attribute iob of R_DO : signal is "true";
70
 
71
begin
72
 
73
  assert PULL="NONE" or PULL="UP" or PULL="DOWN" or PULL="KEEP"
74
    report "assert(PULL): only NONE, UP, DOWN, OR KEEP supported"
75
    severity failure;
76
 
77
  proc_regs: process (CLK)
78
  begin
79 13 wfjm
    if rising_edge(CLK) then
80 2 wfjm
      R_TE <= not OE;
81
      if CEI = '1' then
82
        R_DI <= to_x01(PAD);
83
      end if;
84
      if CEO = '1' then
85
        R_DO <= DO;
86
      end if;
87
    end if;
88
  end process proc_regs;
89
 
90
  proc_comb: process (R_TE, R_DO)
91
  begin
92
    if R_TE = '1' then
93
      PAD <= all_z;
94
    else
95
      PAD <= R_DO;
96
    end if;
97
  end process proc_comb;
98
 
99
  DI <= R_DI;
100
 
101
-- Note: PULL (UP, DOWN or KEEP) is only implemented for simulation, not
102
--       for inference in synthesis. Use pin attributes in UCF's or use
103
--       iob_reg_io_gen_unisim
104
--
105
-- synthesis translate_off
106
 
107
  PULL_UP: if PULL = "UP" generate
108
    PAD <= all_h;
109
  end generate PULL_UP;
110
 
111
  PULL_DOWN: if PULL = "DOWN" generate
112
    PAD <= all_l;
113
  end generate PULL_DOWN;
114
 
115
  PULL_KEEP: if PULL = "KEEP" generate
116
    KEEPER : iob_keeper_gen
117
      generic map (DWIDTH => DWIDTH)
118
      port map    (PAD => PAD);
119
  end generate PULL_KEEP;
120
 
121
-- synthesis translate_on
122
 
123
end syn;

powered by: WebSVN 2.1.0

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