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

Subversion Repositories funbase_ip_library

[/] [funbase_ip_library/] [trunk/] [TUT/] [ip.hwp.communication/] [hibi/] [3.0/] [vhd/] [fifo_demux_wr.vhd] - Blame information for rev 145

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
-------------------------------------------------------------------------------
2
-- File        : fifo_demux_wr.vhd
3
-- Description : Makes two fifos look like a single fifo for the writer.
4
--                The FIFO where to write is selected according to incoming command
5
--
6
--               Write_demux:
7
--               Input : data, addr valid and command 
8
--               Out   : data, addr valid and command to two fifos
9
--
10
--              Note. Fifo_demux_write does not fully support One_Place_Left_Out!
11
----               To be on the safe side, one-place_left signals are ORred
12
----               together when command is IDLE.
13
--                 This may prevent writing to one fifo if the other fifo is
14
--                 is geting full.
15
--
16
--              
17
-- Author      : Erno Salminen
18
-- Project     : Nocbench, Funbasse
19
-- Date        : 05.02.2003
20
-- Modified    : 
21
-- 1.4.2011    ase Modified the commands for HIBI v.3
22
-------------------------------------------------------------------------------
23
-------------------------------------------------------------------------------
24
-- Funbase IP library Copyright (C) 2011 TUT Department of Computer Systems
25
--
26
-- This file is part of HIBI
27
--
28
-- This source file may be used and distributed without
29
-- restriction provided that this copyright statement is not
30
-- removed from the file and that any derivative work contains
31
-- the original copyright notice and the associated disclaimer.
32
--
33
-- This source file is free software; you can redistribute it
34
-- and/or modify it under the terms of the GNU Lesser General
35
-- Public License as published by the Free Software Foundation;
36
-- either version 2.1 of the License, or (at your option) any
37
-- later version.
38
--
39
-- This source is distributed in the hope that it will be
40
-- useful, but WITHOUT ANY WARRANTY; without even the implied
41
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
42
-- PURPOSE.  See the GNU Lesser General Public License for more
43
-- details.
44
--
45
-- You should have received a copy of the GNU Lesser General
46
-- Public License along with this source; if not, download it
47
-- from http://www.opencores.org/lgpl.shtml
48
-------------------------------------------------------------------------------
49
library ieee;
50
use ieee.std_logic_1164.all;
51
use ieee.std_logic_arith.all;
52
use ieee.std_logic_unsigned.all;
53
use work.hibiv3_pkg.all;
54
 
55
 
56
entity fifo_demux_wr is
57
 
58
  generic (
59
    data_width_g : integer := 0;
60
    comm_width_g : integer := 0
61
    );
62
  port (
63
    data_in   : in  std_logic_vector (data_width_g-1 downto 0);
64
    av_in     : in  std_logic;
65
    comm_in   : in  std_logic_vector (comm_width_g-1 downto 0);
66
    we_in     : in  std_logic;
67
    full_out  : out std_logic;
68
    one_p_out : out std_logic;
69
 
70
    -- Data/Comm/AV conencted to both fifos
71
    -- Distinction made with WE!
72
    data_out   : out std_logic_vector (data_width_g-1 downto 0);
73
    comm_out   : out std_logic_vector (comm_width_g-1 downto 0);
74
    av_out     : out std_logic;
75
    we_0_out   : out std_logic;
76
    we_1_out   : out std_logic;
77
    full_0_in  : in  std_logic;
78
    full_1_in  : in  std_logic;
79
    one_p_0_in : in  std_logic;
80
    one_p_1_in : in  std_logic
81
    );
82
 
83
end fifo_demux_wr;
84
 
85
 
86
 
87
 
88
 
89
architecture rtl of fifo_demux_wr is
90
 
91
  -- Selects if debug prints are used (1-3) or not ('0')
92
  constant dbg_level : integer range 0 to 3 := 0;  -- 0= no debug, use 0 for synthesis
93
 
94
  -- Registers may be reset to 'Z' to 'X' so that reset state is clearly
95
  -- distinguished from active state. Using value of rst_value_arr array(dbg_level),
96
  -- the rst value may be easily set to '0' for synthesis.
97
  constant rst_value_arr : std_logic_vector (6 downto 0) := 'X' & 'Z' & 'X' & 'Z' & 'X' & 'Z' & '0';
98
 
99
 
100
begin  -- rtl
101
 
102
 
103
  -- Concurrent assignments, these go straight through
104
  -- and only write enable and full outputs are controlled
105
  av_out   <= av_in;
106
  data_out <= data_in;
107
  comm_out <= comm_in;
108
 
109
 
110
  -- COMB PROC
111
  -- Fully combinational
112
  Demultiplex_data : process (          -- data_in,
113
    -- av_in,
114
    comm_in, we_in,
115
    one_p_0_in, one_p_1_in,
116
    full_0_in, full_1_in)
117
  begin  -- process Demultiplex_data
118
 
119
 
120
 
121
    if comm_in = MSG_WR_c
122
      or comm_in = MSG_RD_c
123
      or comm_in = MSG_RDL_c
124
      or comm_in = MSG_WRNP_c
125
      or comm_in = MSG_WRC_c
126
      or comm_in = CFG_WR_c
127
      or comm_in = CFG_RD_c
128
      or comm_in = EXCL_LOCK_c
129
      or comm_in = EXCL_WR_c
130
      or comm_in = EXCL_RD_c
131
      or comm_in = EXCL_RELEASE_c
132
    then
133
      -- MESSAGE
134
      we_0_out  <= we_in;
135
      we_1_out  <= '0';
136
      full_out  <= full_0_in;
137
      one_p_out <= one_p_0_in;
138
 
139
    elsif comm_in = DATA_WR_c
140
      or comm_in = DATA_RD_c
141
      or comm_in = DATA_RDL_c
142
      or comm_in = DATA_WRNP_c
143
      or comm_in = DATA_WRC_c
144
    then
145
      -- DATA
146
      we_0_out  <= '0';
147
      we_1_out  <= we_in;
148
      full_out  <= full_1_in;
149
      one_p_out <= one_p_1_in;
150
 
151
    else
152
      --IDLE
153
      we_0_out  <= '0';
154
      we_1_out  <= '0';
155
      full_out  <= full_1_in or full_0_in;
156
      one_p_out <= one_p_0_in or one_p_1_in;
157
    end if;
158
  end process Demultiplex_data;
159
 
160
 
161
 
162
end rtl;  --fifo_demux_wr

powered by: WebSVN 2.1.0

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