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 6

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 5 daniel.kho
                signal request:inout 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 2 daniel.kho
                address:in t_addr;
64
                data:in t_msg
65
        );
66
 
67
        procedure writeStream(
68 5 daniel.kho
                signal request:inout t_bfm;
69 2 daniel.kho
                data:in t_msg
70
        );
71
 
72
        procedure read(
73 5 daniel.kho
                signal request:inout 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.
74 2 daniel.kho
                address:in t_addr
75
        );
76
end package tlm;
77
 
78
package body tlm is
79
        procedure write(
80 5 daniel.kho
                signal request:inout 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.
81 2 daniel.kho
                address:in t_addr;
82
                data:in t_msg
83
        ) is begin
84
                request.address<=address;
85
                request.message<=data;
86
                request.trigger<=not request.trigger;
87
        end procedure write;
88
 
89
        procedure writeStream(
90 5 daniel.kho
                signal request:inout t_bfm;
91 2 daniel.kho
                data:in t_msg
92
        ) is begin
93
                request.message<=data;
94
                request.trigger<=not request.trigger;
95
        end procedure writeStream;
96
 
97
        procedure read(
98 5 daniel.kho
                signal request:inout 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.
99 2 daniel.kho
                address:in t_addr
100
        ) is begin
101
                request.address<=address;
102
                request.trigger<=not request.trigger;
103
                --report "request.address: " & to_hstring(request.address);
104
        end procedure read;
105
end package body tlm;

powered by: WebSVN 2.1.0

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