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 44

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 44 daniel.kho
library tauhop; use tauhop.fsm.all, tauhop.tlm.all, tauhop.axiTLM.all;
42 9 daniel.kho
 
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 44 daniel.kho
        signal selTxn:unsigned(3 downto 0):=4x"5";       -- select PRBS by default.
90
        --signal selTxn:unsigned(3 downto 0):=4x"0";
91 42 daniel.kho
 
92 9 daniel.kho
begin
93
        /* Bus functional models. */
94 15 daniel.kho
        axiMaster: entity tauhop.axiBfmMaster(rtl)
95 9 daniel.kho
                port map(
96 17 daniel.kho
                        aclk=>irq_write, n_areset=>not i_reset,
97 9 daniel.kho
 
98
                        readRequest=>readRequest,       writeRequest=>writeRequest,
99
                        readResponse=>readResponse,     writeResponse=>writeResponse,
100
                        axiMaster_in=>axiMaster_in,
101
                        axiMaster_out=>axiMaster_out,
102
 
103 42 daniel.kho
                        lastTransaction=>lastTransaction,
104 13 daniel.kho
                        dbg_axiTxFSM=>dbg_axiTxFSM
105 9 daniel.kho
        );
106
 
107 17 daniel.kho
        /* Clocks and reset. */
108
        /* Power-on Reset circuitry. */
109 42 daniel.kho
        por: process(nReset,clk) is begin
110
                if not nReset then i_reset<='1'; porCnt<=(others=>'1');
111 13 daniel.kho
                elsif rising_edge(clk) then
112 17 daniel.kho
                        i_reset<='0';
113 13 daniel.kho
 
114 17 daniel.kho
                        if porCnt>0 then i_reset<='1'; porCnt<=porCnt-1; end if;
115 13 daniel.kho
                end if;
116
        end process por;
117 9 daniel.kho
 
118
        /* synthesis translate_off */
119 17 daniel.kho
        clk<=not clk after clk'period/2;
120 11 daniel.kho
        process is begin
121 44 daniel.kho
                nReset<='1'; wait for 1 ps;
122
                nReset<='0'; wait for 500 ps;
123
                nReset<='1';
124 11 daniel.kho
                wait;
125
        end process;
126
        /* synthesis translate_on */
127
 
128 17 daniel.kho
        /* Simulation Tester. */
129 9 daniel.kho
 
130 17 daniel.kho
        /* Hardware tester. */
131 42 daniel.kho
        bist: entity work.tester(cdcrv) port map(
132 17 daniel.kho
                clk=>clk, reset=>i_reset,
133
                axiMaster_in=>axiMaster_in,
134
                axiMaster_out=>axiMaster_out,
135
                readRequest=>readRequest, writeRequest=>writeRequest,
136
                readResponse=>readResponse, writeResponse=>writeResponse,
137
                irq_write=>irq_write,
138 42 daniel.kho
                lastTransaction=>lastTransaction,
139 17 daniel.kho
                selTxn=>selTxn
140
        );
141 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.