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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_1_0/] [rtl/] [vhdl/] [db_bus.vhd] - Blame information for rev 292

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 arniml
-------------------------------------------------------------------------------
2
--
3
-- The BUS unit.
4
-- Implements the BUS port logic.
5
--
6 179 arniml
-- $Id: db_bus.vhd,v 1.5 2005-06-11 10:08:43 arniml Exp $
7 4 arniml
--
8
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org)
9
--
10
-- All rights reserved
11
--
12
-- Redistribution and use in source and synthezised forms, with or without
13
-- modification, are permitted provided that the following conditions are met:
14
--
15
-- Redistributions of source code must retain the above copyright notice,
16
-- this list of conditions and the following disclaimer.
17
--
18
-- Redistributions in synthesized form must reproduce the above copyright
19
-- notice, this list of conditions and the following disclaimer in the
20
-- documentation and/or other materials provided with the distribution.
21
--
22
-- Neither the name of the author nor the names of other contributors may
23
-- be used to endorse or promote products derived from this software without
24
-- specific prior written permission.
25
--
26
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
28
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
30
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36
-- POSSIBILITY OF SUCH DAMAGE.
37
--
38
-- Please report bugs to the author, but before you do so, please
39
-- make sure that this is not a derivative work and that
40
-- you have the latest version of this file.
41
--
42
-- The latest version of this file can be found at:
43
--      http://www.opencores.org/cvsweb.shtml/t48/
44
--
45
-------------------------------------------------------------------------------
46
 
47
library ieee;
48
use ieee.std_logic_1164.all;
49
 
50
use work.t48_pack.word_t;
51
 
52 179 arniml
entity t48_db_bus is
53 4 arniml
 
54
  port (
55
    -- Global Interface -------------------------------------------------------
56
    clk_i        : in  std_logic;
57
    res_i        : in  std_logic;
58
    en_clk_i     : in  boolean;
59
    ea_i         : in  std_logic;
60
    -- T48 Bus Interface ------------------------------------------------------
61
    data_i       : in  word_t;
62
    data_o       : out word_t;
63
    write_bus_i  : in  boolean;
64
    read_bus_i   : in  boolean;
65
    -- BUS Interface ----------------------------------------------------------
66
    output_pcl_i : in  boolean;
67
    bidir_bus_i  : in  boolean;
68
    pcl_i        : in  word_t;
69
    db_i         : in  word_t;
70
    db_o         : out word_t;
71
    db_dir_o     : out std_logic
72
  );
73
 
74 179 arniml
end t48_db_bus;
75 4 arniml
 
76
 
77
use work.t48_pack.clk_active_c;
78
use work.t48_pack.res_active_c;
79
use work.t48_pack.bus_idle_level_c;
80
use work.t48_pack.to_stdLogic;
81
 
82 179 arniml
architecture rtl of t48_db_bus is
83 4 arniml
 
84
  -- the BUS output register
85
  signal bus_q    : word_t;
86
 
87
  -- BUS direction marker
88 144 arniml
  signal db_dir_q,
89
         db_dir_qq : std_logic;
90 4 arniml
 
91
begin
92
 
93
  -----------------------------------------------------------------------------
94
  -- Process bus_regs
95
  --
96
  -- Purpose:
97
  --   Implements the BUS output register.
98
  --
99
  bus_regs: process (res_i, clk_i)
100
  begin
101
    if res_i = res_active_c then
102 37 arniml
      bus_q      <= (others => '0');
103 4 arniml
      db_dir_q   <= '0';
104 144 arniml
      db_dir_qq  <= '0';
105 4 arniml
 
106
    elsif clk_i'event and clk_i = clk_active_c then
107
      if en_clk_i then
108 177 arniml
        if write_bus_i then
109
          db_dir_qq <= '1';
110
        else
111
          -- extend bus direction by one machine cycle
112
          db_dir_qq  <= db_dir_q;
113
        end if;
114 4 arniml
 
115
        if write_bus_i then
116
          bus_q    <= data_i;
117
 
118
          db_dir_q <= '1';
119
 
120
        elsif ea_i = '1' or bidir_bus_i then
121
          db_dir_q <= '0';
122
 
123
        end if;
124
 
125
      end if;
126
 
127
    end if;
128
 
129
  end process bus_regs;
130
  --
131
  -----------------------------------------------------------------------------
132
 
133
 
134
  -----------------------------------------------------------------------------
135
  -- Output Mapping.
136
  -----------------------------------------------------------------------------
137
  db_o     <=   pcl_i
138
              when output_pcl_i else
139
                bus_q;
140 177 arniml
  db_dir_o <= db_dir_qq or
141 144 arniml
              to_stdLogic(output_pcl_i);
142 4 arniml
  data_o   <=   (others => bus_idle_level_c)
143
              when not read_bus_i else
144
                db_i;
145
 
146
end rtl;
147
 
148
 
149
-------------------------------------------------------------------------------
150
-- File History:
151
--
152
-- $Log: not supported by cvs2svn $
153 179 arniml
-- Revision 1.4  2005/06/09 22:16:26  arniml
154
-- Implement db_dir_o glitch-safe
155
--
156 177 arniml
-- Revision 1.3  2004/10/25 20:30:18  arniml
157
-- delay db_dir_o by one machine cycle
158
-- this fixes the timing relation between BUS data and WR'
159
--
160 144 arniml
-- Revision 1.2  2004/04/04 14:15:45  arniml
161
-- add dump_compare support
162
--
163 37 arniml
-- Revision 1.1  2004/03/23 21:31:52  arniml
164
-- initial check-in
165 4 arniml
--
166
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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