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

Subversion Repositories axi4_tlm_bfm

[/] [axi4_tlm_bfm/] [trunk/] [rtl/] [user.vhdl] - Blame information for rev 27

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
        Synthesisable use case for AXI4 on-chip messaging.
8
 
9
        To Do:
10
 
11
        Author(s):
12
        - Daniel C.K. Kho, daniel.kho@opencores.org | daniel.kho@tauhop.com
13
 
14
        Copyright (C) 2012-2013 Authors and OPENCORES.ORG
15
 
16
        This source file may be used and distributed without
17
        restriction provided that this copyright statement is not
18
        removed from the file and that any derivative work contains
19
        the original copyright notice and the associated disclaimer.
20
 
21
        This source file is free software; you can redistribute it
22
        and/or modify it under the terms of the GNU Lesser General
23
        Public License as published by the Free Software Foundation;
24
        either version 2.1 of the License, or (at your option) any
25
        later version.
26
 
27
        This source is distributed in the hope that it will be
28
        useful, but WITHOUT ANY WARRANTY; without even the implied
29
        warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
30
        PURPOSE. See the GNU Lesser General Public License for more
31
        details.
32
 
33
        You should have received a copy of the GNU Lesser General
34
        Public License along with this source; if not, download it
35
        from http://www.opencores.org/lgpl.shtml.
36
*/
37 3 daniel.kho
library ieee; use ieee.std_logic_1164.all, ieee.numeric_std.all; use ieee.math_real.all;
38 12 daniel.kho
library tauhop; use tauhop.axiTransactor.all;
39 11 daniel.kho
 
40
/* TODO remove once generic packages are supported. */
41
--library tauhop; use tauhop.tlm.all, tauhop.axiTLM.all;
42
 
43 9 daniel.kho
/* synthesis translate_off */
44
library osvvm; use osvvm.RandomPkg.all; use osvvm.CoveragePkg.all;
45
/* synthesis translate_on */
46 2 daniel.kho
 
47 24 daniel.kho
--library altera; use altera.stp;
48
 
49
 
50 2 daniel.kho
entity user is port(
51
        /* Comment-out for simulation. */
52 24 daniel.kho
--      clk,reset:in std_ulogic;
53 2 daniel.kho
 
54
        /* AXI Master interface */
55 5 daniel.kho
--      axiMaster_in:in t_axi4StreamTransactor_s2m;
56 24 daniel.kho
        axiMaster_out:buffer t_axi4StreamTransactor_m2s;
57 2 daniel.kho
 
58
        /* Debug ports. */
59 24 daniel.kho
        selTxn:in unsigned(3 downto 0):=x"0"
60 2 daniel.kho
);
61
end entity user;
62
 
63
architecture rtl of user is
64 24 daniel.kho
        signal i_reset:std_ulogic:='0';
65 17 daniel.kho
        signal porCnt:unsigned(3 downto 0);
66
 
67 2 daniel.kho
        /* Global counters. */
68
        constant maxSymbols:positive:=2048;             --maximum number of symbols allowed to be transmitted in a frame. Each symbol's width equals tData's width. 
69 12 daniel.kho
        signal symbolsPerTransfer:i_transactor.t_cnt;
70
        signal outstandingTransactions:i_transactor.t_cnt;
71 2 daniel.kho
 
72
        /* BFM signalling. */
73 15 daniel.kho
        signal readRequest,writeRequest:i_transactor.t_bfm:=(address=>(others=>'X'),message=>(others=>'X'),trigger=>false);
74
        signal readResponse,writeResponse:i_transactor.t_bfm;
75 2 daniel.kho
 
76
        /* Tester signals. */
77
        /* synthesis translate_off */
78 24 daniel.kho
        signal clk,reset:std_ulogic:='0';
79 17 daniel.kho
        attribute period:time; attribute period of clk:signal is 10 ps;
80 2 daniel.kho
        /* synthesis translate_on */
81
 
82 24 daniel.kho
        signal dbg_axiTxFSM:axiBfmStatesTx;
83
        signal anlysr_dataIn:std_logic_vector(255 downto 0);
84
        signal anlysr_trigger:std_ulogic;
85
 
86 11 daniel.kho
        signal axiMaster_in:t_axi4StreamTransactor_s2m;
87 2 daniel.kho
        signal irq_write:std_ulogic;            -- clock gating.
88
 
89
begin
90
        /* Bus functional models. */
91 17 daniel.kho
        axiMaster: entity tauhop.axiBfmMaster(rtl)
92 2 daniel.kho
                port map(
93 24 daniel.kho
                        aclk=>irq_write, n_areset=>not i_reset,
94 2 daniel.kho
 
95
                        readRequest=>readRequest,       writeRequest=>writeRequest,
96
                        readResponse=>readResponse,     writeResponse=>writeResponse,
97
                        axiMaster_in=>axiMaster_in,
98
                        axiMaster_out=>axiMaster_out,
99
 
100
                        symbolsPerTransfer=>symbolsPerTransfer,
101 24 daniel.kho
                        outstandingTransactions=>outstandingTransactions,
102
                        dbg_axiTxFSM=>dbg_axiTxFSM
103 2 daniel.kho
        );
104
 
105 24 daniel.kho
        /* Clocks and reset. */
106 17 daniel.kho
        /* Power-on Reset circuitry. */
107 24 daniel.kho
        por: process(reset,clk) is begin
108
                if reset then i_reset<='1'; porCnt<=(others=>'1');
109 17 daniel.kho
                elsif rising_edge(clk) then
110 24 daniel.kho
                        i_reset<='0';
111 17 daniel.kho
 
112 24 daniel.kho
                        if porCnt>0 then i_reset<='1'; porCnt<=porCnt-1; end if;
113 17 daniel.kho
                end if;
114
        end process por;
115 2 daniel.kho
 
116 10 daniel.kho
        /* synthesis translate_off */
117 24 daniel.kho
        clk<=not clk after clk'period/2;
118 10 daniel.kho
        process is begin
119 24 daniel.kho
                reset<='0'; wait for 1 ps;
120
                reset<='1'; wait for 500 ps;
121
                reset<='0';
122 10 daniel.kho
                wait;
123
        end process;
124
        /* synthesis translate_on */
125 9 daniel.kho
 
126 24 daniel.kho
        /* Simulation Tester. */
127 11 daniel.kho
 
128 24 daniel.kho
        /* Hardware tester. */
129
        bist: entity work.tester(rtl) port map(
130
                clk=>clk, reset=>i_reset,
131
                axiMaster_in=>axiMaster_in,
132
                axiMaster_out=>axiMaster_out,
133
                readRequest=>readRequest, writeRequest=>writeRequest,
134
                readResponse=>readResponse, writeResponse=>writeResponse,
135
                irq_write=>irq_write,
136
                symbolsPerTransfer=>symbolsPerTransfer,
137
                outstandingTransactions=>outstandingTransactions,
138
                selTxn=>selTxn
139
        );
140 9 daniel.kho
end architecture rtl;

powered by: WebSVN 2.1.0

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