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 |
|
|
pctFilled:unsigned(7 downto 0);
|
54 |
|
|
nearFull,full:boolean;
|
55 |
|
|
nearEmpty,empty:boolean;
|
56 |
|
|
overflow,underflow:boolean;
|
57 |
|
|
end record t_fifoTransactor;
|
58 |
|
|
end package fifoTLM;
|
59 |
|
|
|
60 |
|
|
package body fifoTLM is
|
61 |
|
|
end package body fifoTLM;
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
/* FIFO Transactor API.
|
65 |
|
|
* Generally, transactors are high-level bus interface models that perform
|
66 |
|
|
* read/write transactions to/from the bus. These models are not concerned
|
67 |
|
|
* with the low-level implementation of the bus protocol. However, the
|
68 |
|
|
* TLM models encapsulate the lower-level models known as the BFM.
|
69 |
|
|
* fifoTLM uses generic package tauhop.tlm, hence inherits basic TLM types and
|
70 |
|
|
* procedures generally used in any messaging system (i.e. address and message
|
71 |
|
|
* information, and bus read/write methods). It also extends the tauhop.tlm
|
72 |
|
|
* package with application-specific types, such as record structures specific
|
73 |
|
|
* to the AXI protocol.
|
74 |
|
|
* fifoTransactor instantiates the fifoTLM, and assigns specific types to the
|
75 |
|
|
* transactor model.
|
76 |
|
|
*/
|
77 |
|
|
library ieee; use ieee.std_logic_1164.all, ieee.numeric_std.all;
|
78 |
|
|
library tauhop;
|
79 |
|
|
package transactor is new tauhop.tlm generic map(
|
80 |
|
|
t_addr=>unsigned(31 downto 0), -- default assignment. Used only for non-stream interfaces.
|
81 |
|
|
t_msg=>unsigned(63 downto 0),
|
82 |
|
|
t_cnt=>unsigned(127 downto 0)
|
83 |
|
|
);
|
84 |
|
|
|
85 |
|
|
library ieee; use ieee.std_logic_1164.all, ieee.numeric_std.all;
|
86 |
|
|
library tauhop; use tauhop.transactor.all;
|
87 |
|
|
package fifoTransactor is new tauhop.fifoTLM generic map(
|
88 |
|
|
--t_data=>unsigned(31 downto 0),
|
89 |
|
|
i_transactor=>tauhop.transactor
|
90 |
|
|
);
|