1 |
9 |
jefflieu |
// -------------------------------------------------------------------------
|
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: 2011/11/10 $
|
11 |
|
|
// Check in by : $Author: max $
|
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 |
|
|
module timing_adapter_8 (
|
29 |
|
|
|
30 |
|
|
// Interface: clk
|
31 |
|
|
input clk, //INPUT : CLK
|
32 |
|
|
input reset, //INPUT : Asynchronous ACTIVE LOW Reset
|
33 |
|
|
// Interface: in
|
34 |
|
|
output reg in_ready, //OUTPUT : 'TIMING ADAPTER' READYNESS TO ACCEPT DATA FROM 'MAC'
|
35 |
|
|
input in_valid, //INPUT : 'MAC TO TIMING ADAPTER' DATA VALID
|
36 |
|
|
input [7: 0] in_data, //INPUT : 'MAC TO TIMING ADAPTER' DATA
|
37 |
|
|
input in_startofpacket, //INPUT : 'MAC TO TIMING ADAPTER' START OF PACKET
|
38 |
|
|
input in_endofpacket, //INPUT : 'MAC TO TIMING ADAPTER' END OF PACKET
|
39 |
|
|
input in_error, //INPUT : 'MAC TO TIMING ADAPTER' PACKET DATA ERROR
|
40 |
|
|
// Interface: out
|
41 |
|
|
input out_ready, //INPUT : 'APPLICATION' READYNESS TO ACCEPT DATA FROM 'TIMING ADAPTER'
|
42 |
|
|
output reg out_valid, //OUTPUT : 'TIMING ADAPTER TO APPLICATION' DATA VALID
|
43 |
|
|
output reg [7: 0] out_data, //OUTPUT : 'TIMING ADAPTER TO APPLICATION' DATA
|
44 |
|
|
output reg out_startofpacket, //OUTPUT : 'TIMING ADAPTER TO APPLICATION' START OF PACKET
|
45 |
|
|
output reg out_endofpacket, //OUTPUT : 'TIMING ADAPTER TO APPLICATION' END OF PACKET
|
46 |
|
|
output reg out_error //OUTPUT : 'TIMING ADAPTER TO APPLICATION' PACKET DATA ERROR
|
47 |
|
|
);
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
|
51 |
|
|
|
52 |
|
|
|
53 |
|
|
// ---------------------------------------------------------------------
|
54 |
|
|
//| Signal Declarations
|
55 |
|
|
// ---------------------------------------------------------------------
|
56 |
|
|
|
57 |
|
|
reg [10: 0] in_payload;
|
58 |
|
|
wire [10: 0] out_payload;
|
59 |
|
|
wire in_ready_wire;
|
60 |
|
|
wire out_valid_wire;
|
61 |
|
|
wire [ 6: 0] fifo_fill;
|
62 |
|
|
reg ready;
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
// ---------------------------------------------------------------------
|
66 |
|
|
//| Payload Mapping
|
67 |
|
|
// ---------------------------------------------------------------------
|
68 |
|
|
always @ (in_data or in_startofpacket or in_endofpacket or in_error or out_payload)
|
69 |
|
|
begin
|
70 |
|
|
in_payload = {in_data,in_startofpacket,in_endofpacket,in_error};
|
71 |
|
|
{out_data,out_startofpacket,out_endofpacket,out_error} = out_payload;
|
72 |
|
|
end
|
73 |
|
|
|
74 |
|
|
// ---------------------------------------------------------------------
|
75 |
|
|
//| FIFO
|
76 |
|
|
// ---------------------------------------------------------------------
|
77 |
|
|
timing_adapter_fifo_8 u_timing_adapter_fifo
|
78 |
|
|
(
|
79 |
|
|
.clk (clk), //INPUT : CLK
|
80 |
|
|
.reset (reset), //INPUT : Asynchronous ACTIVE LOW Reset
|
81 |
|
|
.in_ready (), //OUTPUT : 'TIMING ADAPTER' READYNESS TO ACCEPT DATA FROM 'MAC'
|
82 |
|
|
.in_valid (in_valid), //INPUT : 'MAC TO TIMING ADAPTER' DATA VALID
|
83 |
|
|
.in_data (in_payload), //INPUT : 'MAC TO TIMING ADAPTER' DATA
|
84 |
|
|
.out_ready (ready), //INPUT : 'APPLICATION' READYNESS TO ACCEPT DATA FROM 'TIMING ADAPTER'
|
85 |
|
|
.out_valid (out_valid_wire), //OUTPUT : 'TIMING ADAPTER TO APPLICATION' DATA VALID
|
86 |
|
|
.out_data (out_payload), //OUTPUT : 'TIMING ADAPTER TO APPLICATION' DATA
|
87 |
|
|
.fill_level (fifo_fill) //OUTPUT : 'TIMING ADAPTER' FIFO FILL LEVEL
|
88 |
|
|
);
|
89 |
|
|
|
90 |
|
|
// ---------------------------------------------------------------------
|
91 |
|
|
//| Ready & valid signals.
|
92 |
|
|
// ---------------------------------------------------------------------
|
93 |
|
|
always @ (fifo_fill or out_valid_wire or out_ready)
|
94 |
|
|
begin
|
95 |
|
|
in_ready <= (fifo_fill < 40);
|
96 |
|
|
out_valid <= out_valid_wire;
|
97 |
|
|
ready = out_ready;
|
98 |
|
|
end
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
endmodule
|
102 |
|
|
|