w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
iob_reg_io_gen.vhd
Go to the documentation of this file.
1-- $Id: iob_reg_io_gen.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2007-2008 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: iob_reg_io_gen - syn
7-- Description: Registered IOB, in/output, vector
8--
9-- Dependencies: iob_keeper_gen [sim only]
10-- Test bench: -
11-- Target Devices: generic Spartan, Virtex
12-- Tool versions: ise 8.2-14.7; viv 2014.4-2016.1; ghdl 0.18-0.33
13-- Revision History:
14-- Date Rev Version Comment
15-- 2008-05-22 149 1.0.4 use internally TE to match OBUFT T polarity
16-- 2008-05-22 148 1.0.3 remove UNISIM prim's; PULL implemented only for sim
17-- 2008-05-18 147 1.0.2 add PULL generic, to enable PULL-UP,-DOWN or KEEPER
18-- 2007-12-16 101 1.0.1 add INIT generic ports
19-- 2007-12-08 100 1.0 Initial version
20------------------------------------------------------------------------------
21
22library ieee;
23use ieee.std_logic_1164.all;
24
25use work.slvtypes.all;
26use work.xlib.all;
27
28entity iob_reg_io_gen is -- registered IOB, in/output, vector
29 generic (
30 DWIDTH : positive := 16; -- data port width
31 INITI : slbit := '0'; -- initial state ( in flop)
32 INITO : slbit := '0'; -- initial state (out flop)
33 INITE : slbit := '0'; -- initial state ( oe flop)
34 PULL : string := "NONE"); -- pull-up,-down or keeper
35 port (
36 CLK : in slbit; -- clock
37 CEI : in slbit := '1'; -- clock enable ( in flops)
38 CEO : in slbit := '1'; -- clock enable (out flops)
39 OE : in slbit; -- output enable
40 DI : out slv(DWIDTH-1 downto 0); -- input data (read from pad)
41 DO : in slv(DWIDTH-1 downto 0); -- output data (write to pad)
42 PAD : inout slv(DWIDTH-1 downto 0) -- i/o pad
43 );
45
46
47architecture syn of iob_reg_io_gen is
48
49 signal R_TE : slbit := not INITE;
50 signal R_DI : slv(DWIDTH-1 downto 0) := (others=>INITI);
51 signal R_DO : slv(DWIDTH-1 downto 0) := (others=>INITO);
52
53 constant all_z : slv(DWIDTH-1 downto 0) := (others=>'Z');
54 constant all_l : slv(DWIDTH-1 downto 0) := (others=>'L');
55 constant all_h : slv(DWIDTH-1 downto 0) := (others=>'H');
56
57 attribute iob : string;
58 attribute iob of R_TE : signal is "true";
59 attribute iob of R_DI : signal is "true";
60 attribute iob of R_DO : signal is "true";
61
62begin
63
64 assert PULL="NONE" or PULL="UP" or PULL="DOWN" or PULL="KEEP"
65 report "assert(PULL): only NONE, UP, DOWN, OR KEEP supported"
66 severity failure;
67
68 proc_regs: process (CLK)
69 begin
70 if rising_edge(CLK) then
71 R_TE <= not OE;
72 if CEI = '1' then
73 R_DI <= to_x01(PAD);
74 end if;
75 if CEO = '1' then
76 R_DO <= DO;
77 end if;
78 end if;
79 end process proc_regs;
80
81 proc_comb: process (R_TE, R_DO)
82 begin
83 if R_TE = '1' then
84 PAD <= all_z;
85 else
86 PAD <= R_DO;
87 end if;
88 end process proc_comb;
89
90 DI <= R_DI;
91
92-- Note: PULL (UP, DOWN or KEEP) is only implemented for simulation, not
93-- for inference in synthesis. Use pin attributes in UCF's or XDC's
94--
95-- synthesis translate_off
96
97 PULL_UP: if PULL = "UP" generate
98 PAD <= all_h;
99 end generate PULL_UP;
100
101 PULL_DOWN: if PULL = "DOWN" generate
102 PAD <= all_l;
103 end generate PULL_DOWN;
104
105 PULL_KEEP: if PULL = "KEEP" generate
106 KEEPER : iob_keeper_gen
107 generic map (DWIDTH => DWIDTH)
108 port map (PAD => PAD);
109 end generate PULL_KEEP;
110
111-- synthesis translate_on
112
113end syn;
inout PAD slv( DWIDTH- 1 downto 0)
DWIDTH positive := 16
slv( DWIDTH- 1 downto 0) :=( others => 'L') all_l
slv( DWIDTH- 1 downto 0) :=( others => INITO) R_DO
slv( DWIDTH- 1 downto 0) :=( others => INITI) R_DI
slbit :=not INITE R_TE
slv( DWIDTH- 1 downto 0) :=( others => 'Z') all_z
slv( DWIDTH- 1 downto 0) :=( others => 'H') all_h
in CEO slbit := '1'
in CEI slbit := '1'
INITO slbit := '0'
PULL string := "NONE"
INITE slbit := '0'
inout PAD slv( DWIDTH- 1 downto 0)
INITI slbit := '0'
in DO slv( DWIDTH- 1 downto 0)
out DI slv( DWIDTH- 1 downto 0)
DWIDTH positive := 16
std_logic slbit
Definition: slvtypes.vhd:30
std_logic_vector slv
Definition: slvtypes.vhd:31
Definition: xlib.vhd:35