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

Subversion Repositories axi4_tlm_bfm

[/] [axi4_tlm_bfm/] [trunk/] [rtl/] [packages/] [pkg-tlm.vhdl] - Blame information for rev 29

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

Line No. Rev Author Line
1 2 daniel.kho
/*
2
        This file is part of the AXI4 Transactor and Bus Functional Model
3
        (axi4_tlm_bfm) project:
4
                http://www.opencores.org/project,axi4_tlm_bfm
5
 
6
        Description
7
        This implements a generic interface for transactors, and has a set
8
        of reusable procedures to read and write from / to a bus. This
9
        interface can be used in many different bus protocols, by means of
10
        instantiating this package. An example implementation for the AXI4
11
        protocol can be found at
12
                pkg-axi-tlm.vhdl
13
        under the axi4_tlm_bfm project.
14
 
15
        To Do:
16
 
17
        Author(s):
18
        - Daniel C.K. Kho, daniel.kho@opencores.org | daniel.kho@tauhop.com
19
 
20
        Copyright (C) 2012-2013 Authors and OPENCORES.ORG
21
 
22
        This source file may be used and distributed without
23
        restriction provided that this copyright statement is not
24
        removed from the file and that any derivative work contains
25
        the original copyright notice and the associated disclaimer.
26
 
27
        This source file is free software; you can redistribute it
28
        and/or modify it under the terms of the GNU Lesser General
29
        Public License as published by the Free Software Foundation;
30
        either version 2.1 of the License, or (at your option) any
31
        later version.
32
 
33
        This source is distributed in the hope that it will be
34
        useful, but WITHOUT ANY WARRANTY; without even the implied
35
        warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
36
        PURPOSE. See the GNU Lesser General Public License for more
37
        details.
38
 
39
        You should have received a copy of the GNU Lesser General
40
        Public License along with this source; if not, download it
41
        from http://www.opencores.org/lgpl.shtml.
42
*/
43
/* FIXME VHDL-2008 instantiated package. Unsupported by VCS-MX, Quartus, and Vivado. QuestaSim/ModelSim supports well. */
44
library ieee; use ieee.std_logic_1164.all, ieee.numeric_std.all;
45
--use std.textio.all;
46
 
47
package tlm is
48
        generic(type t_addr; type t_msg; type t_cnt);
49
 
50
--      /* TODO remove once generic packages are supported. */
51
--      subtype t_addr is unsigned(31 downto 0);
52
--      subtype t_msg is signed(63 downto 0);
53
 
54
        /* BFM control interface. */
55 5 daniel.kho
        type t_bfm is record
56 2 daniel.kho
                address:t_addr;
57
                message:t_msg;
58
                trigger:boolean;
59 5 daniel.kho
        end record t_bfm;
60 2 daniel.kho
 
61
        procedure write(
62 12 daniel.kho
                signal request:out t_bfm;               --FIXME use inout because Quartus doesn't yet allow reading of "out" within a procedure. VHDL-2008 allows this, and QuestaSim works fine.
63 8 daniel.kho
                address:in t_addr;                              -- used only for non-stream interfaces.
64 2 daniel.kho
                data:in t_msg
65
        );
66
 
67
        procedure read(
68 12 daniel.kho
                signal request:out t_bfm;               --FIXME use inout because Quartus doesn't yet allow reading of "out" within a procedure. VHDL-2008 allows this, and QuestaSim works fine.
69 8 daniel.kho
                address:in t_addr                               -- used only for non-stream interfaces.
70 2 daniel.kho
        );
71
end package tlm;
72
 
73
package body tlm is
74
        procedure write(
75 12 daniel.kho
                signal request:out t_bfm;               --FIXME use inout because Quartus doesn't yet allow reading of "out" within a procedure. VHDL-2008 allows this, and QuestaSim works fine.
76 8 daniel.kho
                address:in t_addr;                              -- used only for non-stream interfaces.
77 2 daniel.kho
                data:in t_msg
78
        ) is begin
79
                request.address<=address;
80
                request.message<=data;
81
                request.trigger<=not request.trigger;
82
        end procedure write;
83
 
84
        procedure read(
85 12 daniel.kho
                signal request:out t_bfm;               --FIXME use inout because Quartus doesn't yet allow reading of "out" within a procedure. VHDL-2008 allows this, and QuestaSim works fine.
86 8 daniel.kho
                address:in t_addr                               -- used only for non-stream interfaces.
87 2 daniel.kho
        ) is begin
88
                request.address<=address;
89
                request.trigger<=not request.trigger;
90
                --report "request.address: " & to_hstring(request.address);
91
        end procedure read;
92 10 daniel.kho
end package body tlm;

powered by: WebSVN 2.1.0

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