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

Subversion Repositories axi4_tlm_bfm

[/] [axi4_tlm_bfm/] [trunk/] [rtl/] [quartus-synthesis/] [user.vhdl] - Blame information for rev 42

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

Line No. Rev Author Line
1 9 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
library ieee; use ieee.std_logic_1164.all, ieee.numeric_std.all; use ieee.math_real.all;
38
--library tauhop; use tauhop.transactor.all, tauhop.axiTransactor.all;          --TODO just use axiTransactor here as transactor should already be wrapped up.
39
 
40
/* TODO remove once generic packages are supported. */
41
library tauhop; use tauhop.tlm.all, tauhop.axiTLM.all;
42
 
43
/* synthesis translate_off */
44
library osvvm; use osvvm.RandomPkg.all; use osvvm.CoveragePkg.all;
45
/* synthesis translate_on */
46
 
47
library altera; use altera.stp;
48
 
49
 
50
entity user is port(
51
        /* Comment-out for simulation. */
52 42 daniel.kho
        clk,nReset:in std_ulogic;
53 9 daniel.kho
 
54
        /* AXI Master interface */
55
--      axiMaster_in:in t_axi4StreamTransactor_s2m;
56 42 daniel.kho
        axiMaster_out:buffer t_axi4StreamTransactor_m2s
57 9 daniel.kho
 
58
        /* Debug ports. */
59 42 daniel.kho
--      selTxn:in unsigned(3 downto 0):=x"5"    -- select PRBS by default.
60 9 daniel.kho
);
61
end entity user;
62
 
63
architecture rtl of user is
64 17 daniel.kho
        signal i_reset:std_ulogic:='0';
65
        signal porCnt:unsigned(3 downto 0);
66
 
67 9 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
 
70 42 daniel.kho
        signal lastTransaction:boolean;
71
 
72 9 daniel.kho
        /* BFM signalling. */
73 17 daniel.kho
        signal readRequest,writeRequest:t_bfm:=(address=>(others=>'X'),message=>(others=>'X'),trigger=>false);
74
        signal readResponse,writeResponse:t_bfm;
75 9 daniel.kho
 
76
        /* Tester signals. */
77
        /* synthesis translate_off */
78 42 daniel.kho
        signal clk,nReset:std_ulogic:='0';
79 17 daniel.kho
        attribute period:time; attribute period of clk:signal is 10 ps;
80 9 daniel.kho
        /* synthesis translate_on */
81 13 daniel.kho
 
82
        signal dbg_axiTxFSM:axiBfmStatesTx;
83 17 daniel.kho
        signal anlysr_dataIn:std_logic_vector(255 downto 0);
84 9 daniel.kho
        signal anlysr_trigger:std_ulogic;
85
 
86
        signal axiMaster_in:t_axi4StreamTransactor_s2m;
87
        signal irq_write:std_ulogic;            -- clock gating.
88
 
89 42 daniel.kho
        signal selTxn:unsigned(3 downto 0):=4x"0";        -- select PRBS by default.
90
 
91 9 daniel.kho
begin
92
        /* Bus functional models. */
93 15 daniel.kho
        axiMaster: entity tauhop.axiBfmMaster(rtl)
94 9 daniel.kho
                port map(
95 17 daniel.kho
                        aclk=>irq_write, n_areset=>not i_reset,
96 9 daniel.kho
 
97
                        readRequest=>readRequest,       writeRequest=>writeRequest,
98
                        readResponse=>readResponse,     writeResponse=>writeResponse,
99
                        axiMaster_in=>axiMaster_in,
100
                        axiMaster_out=>axiMaster_out,
101
 
102 42 daniel.kho
                        lastTransaction=>lastTransaction,
103 13 daniel.kho
                        dbg_axiTxFSM=>dbg_axiTxFSM
104 9 daniel.kho
        );
105
 
106 17 daniel.kho
        /* Clocks and reset. */
107
        /* Power-on Reset circuitry. */
108 42 daniel.kho
        por: process(nReset,clk) is begin
109
                if not nReset then i_reset<='1'; porCnt<=(others=>'1');
110 13 daniel.kho
                elsif rising_edge(clk) then
111 17 daniel.kho
                        i_reset<='0';
112 13 daniel.kho
 
113 17 daniel.kho
                        if porCnt>0 then i_reset<='1'; porCnt<=porCnt-1; end if;
114 13 daniel.kho
                end if;
115
        end process por;
116 9 daniel.kho
 
117
        /* synthesis translate_off */
118 17 daniel.kho
        clk<=not clk after clk'period/2;
119 11 daniel.kho
        process is begin
120 42 daniel.kho
                nReset<='0'; wait for 1 ps;
121
                nReset<='1'; wait for 500 ps;
122
                nReset<='0';
123 11 daniel.kho
                wait;
124
        end process;
125
        /* synthesis translate_on */
126
 
127 17 daniel.kho
        /* Simulation Tester. */
128 9 daniel.kho
 
129 17 daniel.kho
        /* Hardware tester. */
130 42 daniel.kho
        bist: entity work.tester(cdcrv) port map(
131 17 daniel.kho
                clk=>clk, reset=>i_reset,
132
                axiMaster_in=>axiMaster_in,
133
                axiMaster_out=>axiMaster_out,
134
                readRequest=>readRequest, writeRequest=>writeRequest,
135
                readResponse=>readResponse, writeResponse=>writeResponse,
136
                irq_write=>irq_write,
137 42 daniel.kho
                lastTransaction=>lastTransaction,
138 17 daniel.kho
                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.