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

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [cpu_sysc_plugin/] [riverlib/] [core/] [br_predic.h] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 sergeykhbr
/*
2
 *  Copyright 2018 Sergey Khabarov, sergeykhbr@gmail.com
3
 *
4
 *  Licensed under the Apache License, Version 2.0 (the "License");
5
 *  you may not use this file except in compliance with the License.
6
 *  You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 *  Unless required by applicable law or agreed to in writing, software
11
 *  distributed under the License is distributed on an "AS IS" BASIS,
12
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 *  See the License for the specific language governing permissions and
14
 *  limitations under the License.
15 3 sergeykhbr
 */
16
 
17
#ifndef __DEBUGGER_RIVERLIB_BR_PREDIC_H__
18
#define __DEBUGGER_RIVERLIB_BR_PREDIC_H__
19
 
20
#include <systemc.h>
21
#include "../river_cfg.h"
22
 
23
namespace debugger {
24
 
25
SC_MODULE(BranchPredictor) {
26
    sc_in<bool> i_clk;                  // CPU clock
27
    sc_in<bool> i_nrst;                 // Reset. Active LOW.
28
    sc_in<bool> i_req_mem_fire;         // Memory request was accepted
29
    sc_in<bool> i_resp_mem_valid;       // Memory response from ICache is valid
30
    sc_in<sc_uint<BUS_ADDR_WIDTH>> i_resp_mem_addr; // Memory response address
31
    sc_in<sc_uint<32>> i_resp_mem_data; // Memory response value
32
    sc_in<bool> i_f_predic_miss;        // Fetch modul detects deviation between predicted and valid pc.
33
    sc_in<sc_uint<32>> i_e_npc;         // Valid instruction value awaited by 'Executor'
34
    sc_in<sc_uint<RISCV_ARCH>> i_ra;    // Return address register value
35
    sc_out<sc_uint<32>> o_npc_predict;  // Predicted next instruction address
36
 
37
    void comb();
38
    void registers();
39
 
40
    SC_HAS_PROCESS(BranchPredictor);
41
 
42
    BranchPredictor(sc_module_name name_);
43
 
44
    void generateVCD(sc_trace_file *i_vcd, sc_trace_file *o_vcd);
45
 
46
private:
47
    struct RegistersType {
48
        sc_signal<sc_uint<BUS_ADDR_WIDTH>> npc;
49 4 sergeykhbr
        sc_signal<sc_uint<BUS_ADDR_WIDTH>> resp_mem_addr;
50
        sc_signal<sc_uint<32>> resp_mem_data;
51 3 sergeykhbr
    } v, r;
52 4 sergeykhbr
    sc_uint<BUS_ADDR_WIDTH> wb_npc;
53 3 sergeykhbr
};
54
 
55
 
56
}  // namespace debugger
57
 
58
#endif  // __DEBUGGER_RIVERLIB_BR_PREDIC_H__

powered by: WebSVN 2.1.0

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