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

Subversion Repositories fwrisc

[/] [fwrisc/] [trunk/] [ve/] [fwrisc_tracer_bfm/] [fwrisc_tracer_bfm.sv] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mballance
/****************************************************************************
2
 * fwrisc_tracer_bfm.sv
3
 *
4
 * Copyright 2018 Matthew Ballance
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the
7
 * "License"); you may not use this file except in
8
 * compliance with the License.  You may obtain a copy of
9
 * the License at
10
 *
11
 * http://www.apache.org/licenses/LICENSE-2.0
12
 *
13
 * Unless required by applicable law or agreed to in
14
 * writing, software distributed under the License is
15
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
16
 * CONDITIONS OF ANY KIND, either express or implied.  See
17
 * the License for the specific language governing
18
 * permissions and limitations under the License.
19
 *
20
 *
21
 ****************************************************************************/
22
 
23
/**
24
 * Module: fwrisc_tracer_bfm
25
 *
26
 * TODO: Add interface documentation
27
 */
28
module fwrisc_tracer_bfm(
29
                input                   clock,
30
                input                   reset,
31
                input [31:0]    addr,
32
                input [31:0]    instr,
33
                input                   ivalid,
34
                input [31:0]    raddr,
35
                input [31:0]    rdata,
36
                input                   rwrite,
37
                input [31:0]    maddr,
38
                input [31:0]    mdata,
39
                input [3:0]             mstrb,
40
                input                   mwrite,
41
                input                   mvalid
42
                );
43
 
44
        int unsigned                    m_id;
45
 
46
        import "DPI-C" context function int unsigned fwrisc_tracer_bfm_register(string path);
47
 
48
        initial begin
49
                $display("fwrisc_tracer_bfm: %m");
50
                m_id = fwrisc_tracer_bfm_register($sformatf("%m"));
51
        end
52
 
53
        import "DPI-C" function void fwrisc_tracer_bfm_regwrite(
54
                        int unsigned    id,
55
                        int unsigned    raddr,
56
                        int unsigned    rdata);
57
 
58
        always @(posedge clock) begin
59
                if (rwrite) begin
60
                        fwrisc_tracer_bfm_regwrite(m_id, raddr, rdata);
61
                end
62
        end
63
 
64
        import "DPI-C" function void fwrisc_tracer_bfm_exec(
65
                        int unsigned    id,
66
                        int unsigned    addr,
67
                        int unsigned    instr);
68
 
69
        always @(posedge clock) begin
70
                if (ivalid) begin
71
                        fwrisc_tracer_bfm_exec(m_id, addr, instr);
72
                end
73
        end
74
 
75
        import "DPI-C" function void fwrisc_tracer_bfm_memwrite(
76
                        int unsigned    id,
77
                        int unsigned    addr,
78
                        byte unsigned   mask,
79
                        int unsigned    data);
80
        always @(posedge clock) begin
81
                if (mvalid && mwrite) begin
82
                        fwrisc_tracer_bfm_memwrite(m_id, maddr, mstrb, mdata);
83
                end
84
        end
85
 
86
endmodule
87
 
88
 

powered by: WebSVN 2.1.0

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