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

Subversion Repositories esoc

[/] [esoc/] [trunk/] [Sources/] [altera/] [esoc_port_mac/] [testbench/] [model/] [loopback_adapter.vhd] - Blame information for rev 47

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

Line No. Rev Author Line
1 42 lmaarsen
-- -------------------------------------------------------------------------
2
-- -------------------------------------------------------------------------
3
--
4
-- Revision Control Information
5
--
6
-- $RCSfile: altera_tse_timing_adapter8.v,v $
7
-- $Source: /ipbu/cvs/sio/projects/TriSpeedEthernet/src/RTL/MAC/mac/timing_adapter/altera_tse_timing_adapter8.v,v $
8
--
9
-- $Revision: #1 $
10
-- $Date: 2008/08/09 $
11
-- Check in by : $Author: sc-build $
12
-- Author      : SKNg
13
--
14
-- Project     : Triple Speed Ethernet - 10/100/1000 MAC
15
--
16
-- Description : SIMULATION ONLY
17
--
18
-- AVALON STREAMING TIMING ADAPTER FOR 8BIT IMPLEMENTATION
19
 
20
-- 
21
-- ALTERA Confidential and Proprietary
22
-- Copyright 2006 (c) Altera Corporation
23
-- All rights reserved
24
--
25
-- -------------------------------------------------------------------------
26
-- -------------------------------------------------------------------------
27
 
28
library ieee ;
29
use ieee.std_logic_1164.all ;
30
use ieee.std_logic_arith.all ;
31
use ieee.std_logic_unsigned.all ;
32
 
33
 
34
 
35
 
36
entity loopback_adapter is
37
port (
38
 
39
  -- Interface: clk                     
40
  clk                  : in std_logic;
41
  reset                : in std_logic;
42
  -- Interface: in
43
  in_ready              : out std_logic;
44
  in_valid              : in  std_logic;
45
  in_data               : in  std_logic_vector (7 downto 0);
46
  in_startofpacket      : in  std_logic;
47
  in_endofpacket        : in  std_logic;
48
  in_error              : in  std_logic_vector(4 downto 0);
49
  -- Interface: out
50
  out_ready             : in std_logic;
51
  out_valid             : out std_logic;
52
  out_data              : out std_logic_vector (7 downto 0);
53
  out_startofpacket     : out std_logic;
54
  out_endofpacket       : out std_logic;
55
  out_error             : out std_logic
56
);
57
end loopback_adapter;
58
 
59
 
60
architecture Behav of loopback_adapter is
61
 
62
   -- Component instantiated by Turbo autoplace on 20/02/2008 at 23:58:54
63
   COMPONENT loopback_adapter_fifo
64
 
65
        generic (
66
          DEPTH      : integer := 2048;
67
          DATA_WIDTH : integer := 11;
68
          ADDR_WIDTH : integer := 11
69
        );
70
         PORT
71
         (
72
                 clk            :       IN  STD_LOGIC;
73
                 reset          :       IN  STD_LOGIC;
74
                 in_valid   :   in  std_logic;
75
                 in_data    :   in  std_logic_vector(10 downto 0);
76
                 out_ready      :       IN  STD_LOGIC;
77
 
78
                 in_ready       :       out  STD_LOGIC;
79
                 out_valid  :   out  std_logic;
80
                 out_data   :   out  std_logic_vector(10 downto 0);
81
                 fill_level :   out  std_logic_vector(11 downto 0)
82
         );
83
   END COMPONENT;
84
 
85
   -- ---------------------------------------------------------------------
86
   --| Signal Declarations
87
   -- ---------------------------------------------------------------------
88
 
89
   signal in_payload    : std_logic_vector(10 downto 0);
90
   signal out_payload   : std_logic_vector(10 downto 0);
91
   signal in_ready_wire : std_logic;
92
   signal out_valid_wire: std_logic;
93
   signal fifo_fill     : std_logic_vector(11 downto 0);
94
   signal ready         : std_logic;
95
   signal in_err        : std_logic;
96
 
97
begin
98
 
99
 
100
   -- ---------------------------------------------------------------------
101
   --| Payload Mapping
102
   -- ---------------------------------------------------------------------
103
   process (in_data,in_startofpacket,in_endofpacket,in_error,out_payload)
104
   begin
105
     in_err <= in_error(0) or in_error(1) or in_error(2) or in_error(3) or in_error(4);
106
     in_payload <= in_data & in_startofpacket & in_endofpacket & in_err;
107
 
108
     out_data           <= out_payload(10 downto 3);
109
     out_startofpacket  <= out_payload(2);
110
     out_endofpacket    <= out_payload(1);
111
     out_error          <= out_payload(0);
112
 
113
   end process;
114
 
115
   -- ---------------------------------------------------------------------
116
   --| FIFO
117
   -- ---------------------------------------------------------------------
118
   u_loopback_fifo: loopback_adapter_fifo
119
   port map
120
     (
121
       clk       => clk,
122
       reset     => reset,
123
       in_ready  => open,
124
       in_valid  => in_valid,
125
       in_data   => in_payload,
126
       out_ready => ready,
127
       out_valid => out_valid_wire,
128
       out_data  => out_payload,
129
       fill_level=> fifo_fill
130
       );
131
 
132
   -- ---------------------------------------------------------------------
133
   --| Ready & valid signals.
134
   -- ---------------------------------------------------------------------
135
   process (fifo_fill, out_valid_wire, out_ready)
136
    begin
137
      if (fifo_fill < 48) then
138
        in_ready <= '1';
139
      else
140
        in_ready <= '0';
141
      end if;
142
 
143
      out_valid <= out_valid_wire;
144
      ready <= out_ready;
145
   end process;
146
 
147
 
148
end behav;
149
 

powered by: WebSVN 2.1.0

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