1 |
2 |
daniel.kho |
/*
|
2 |
|
|
This file is part of the Memories project:
|
3 |
|
|
http://www.opencores.org/project,wb_fifo
|
4 |
|
|
|
5 |
|
|
Description
|
6 |
|
|
Implementation of FIFO transactor data structures and high-level API.
|
7 |
|
|
|
8 |
|
|
To Do:
|
9 |
|
|
|
10 |
|
|
Author(s):
|
11 |
|
|
- Daniel C.K. Kho, daniel.kho@opencores.org | daniel.kho@tauhop.com
|
12 |
|
|
|
13 |
|
|
Copyright (C) 2012-2013 Authors and OPENCORES.ORG
|
14 |
|
|
|
15 |
|
|
This source file may be used and distributed without
|
16 |
|
|
restriction provided that this copyright statement is not
|
17 |
|
|
removed from the file and that any derivative work contains
|
18 |
|
|
the original copyright notice and the associated disclaimer.
|
19 |
|
|
|
20 |
|
|
This source file is free software; you can redistribute it
|
21 |
|
|
and/or modify it under the terms of the GNU Lesser General
|
22 |
|
|
Public License as published by the Free Software Foundation;
|
23 |
|
|
either version 2.1 of the License, or (at your option) any
|
24 |
|
|
later version.
|
25 |
|
|
|
26 |
|
|
This source is distributed in the hope that it will be
|
27 |
|
|
useful, but WITHOUT ANY WARRANTY; without even the implied
|
28 |
|
|
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
29 |
|
|
PURPOSE. See the GNU Lesser General Public License for more
|
30 |
|
|
details.
|
31 |
|
|
|
32 |
|
|
You should have received a copy of the GNU Lesser General
|
33 |
|
|
Public License along with this source; if not, download it
|
34 |
|
|
from http://www.opencores.org/lgpl.shtml.
|
35 |
|
|
*/
|
36 |
|
|
/* FIXME VHDL-2008 instantiated package. Unsupported by VCS-MX, Quartus, and Vivado. QuestaSim/ModelSim supports well. */
|
37 |
|
|
library ieee; use ieee.std_logic_1164.all, ieee.numeric_std.all;
|
38 |
|
|
--use std.textio.all;
|
39 |
|
|
library tauhop; --use tauhop.transactor.all;
|
40 |
|
|
|
41 |
|
|
/* Record I/O data structures for AXI interface transactor (block interface). */
|
42 |
|
|
package fifoTLM is
|
43 |
|
|
generic(
|
44 |
|
|
package i_transactor is new tauhop.tlm generic map(<>)
|
45 |
|
|
);
|
46 |
|
|
/* Makes i_transactor.t_addr, i_transactor.t_msg, and i_transactor.t_cnt visible. */
|
47 |
|
|
use i_transactor.all;
|
48 |
|
|
|
49 |
|
|
/* FIFO Transactor block interface. */
|
50 |
|
|
type t_fifoTransactor is record
|
51 |
|
|
writeRequest,readRequest:t_bfm;
|
52 |
|
|
writeResponse,readResponse:t_bfm;
|
53 |
|
|
end record t_fifoTransactor;
|
54 |
3 |
daniel.kho |
|
55 |
4 |
daniel.kho |
/* Use separate record for FIFO signalling.
|
56 |
|
|
This will make it easier when we need to split up the request and response
|
57 |
|
|
structures into separate records (for different directions).
|
58 |
3 |
daniel.kho |
*/
|
59 |
|
|
type t_fifo is record
|
60 |
|
|
pctFilled:unsigned(7 downto 0);
|
61 |
|
|
nearFull,full:boolean;
|
62 |
|
|
nearEmpty,empty:boolean;
|
63 |
|
|
overflow,underflow:boolean;
|
64 |
|
|
end record t_fifo;
|
65 |
2 |
daniel.kho |
end package fifoTLM;
|
66 |
|
|
|
67 |
|
|
package body fifoTLM is
|
68 |
|
|
end package body fifoTLM;
|
69 |
|
|
|
70 |
|
|
|
71 |
|
|
/* FIFO Transactor API.
|
72 |
|
|
* Generally, transactors are high-level bus interface models that perform
|
73 |
|
|
* read/write transactions to/from the bus. These models are not concerned
|
74 |
|
|
* with the low-level implementation of the bus protocol. However, the
|
75 |
|
|
* TLM models encapsulate the lower-level models known as the BFM.
|
76 |
|
|
* fifoTLM uses generic package tauhop.tlm, hence inherits basic TLM types and
|
77 |
|
|
* procedures generally used in any messaging system (i.e. address and message
|
78 |
|
|
* information, and bus read/write methods). It also extends the tauhop.tlm
|
79 |
|
|
* package with application-specific types, such as record structures specific
|
80 |
|
|
* to the AXI protocol.
|
81 |
|
|
* fifoTransactor instantiates the fifoTLM, and assigns specific types to the
|
82 |
|
|
* transactor model.
|
83 |
|
|
*/
|
84 |
|
|
library ieee; use ieee.std_logic_1164.all, ieee.numeric_std.all;
|
85 |
|
|
library tauhop;
|
86 |
|
|
package transactor is new tauhop.tlm generic map(
|
87 |
|
|
t_addr=>unsigned(31 downto 0), -- default assignment. Used only for non-stream interfaces.
|
88 |
|
|
t_msg=>unsigned(63 downto 0),
|
89 |
|
|
t_cnt=>unsigned(127 downto 0)
|
90 |
|
|
);
|
91 |
|
|
|
92 |
|
|
library ieee; use ieee.std_logic_1164.all, ieee.numeric_std.all;
|
93 |
|
|
library tauhop; use tauhop.transactor.all;
|
94 |
|
|
package fifoTransactor is new tauhop.fifoTLM generic map(
|
95 |
|
|
--t_data=>unsigned(31 downto 0),
|
96 |
|
|
i_transactor=>tauhop.transactor
|
97 |
|
|
);
|