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 2

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

Line No. Rev Author Line
1 2 sergeykhbr
/**
2
 * @file
3
 * @copyright  Copyright 2016 GNSS Sensor Ltd. All right reserved.
4
 * @author     Sergey Khabarov - sergeykhbr@gmail.com
5
 * @brief      Branch predictor.
6
 */
7
 
8
#ifndef __DEBUGGER_RIVERLIB_BR_PREDIC_H__
9
#define __DEBUGGER_RIVERLIB_BR_PREDIC_H__
10
 
11
#include <systemc.h>
12
#include "../river_cfg.h"
13
 
14
namespace debugger {
15
 
16
SC_MODULE(BranchPredictor) {
17
    sc_in<bool> i_clk;                  // CPU clock
18
    sc_in<bool> i_nrst;                 // Reset. Active LOW.
19
    sc_in<bool> i_req_mem_fire;         // Memory request was accepted
20
    sc_in<bool> i_resp_mem_valid;       // Memory response from ICache is valid
21
    sc_in<sc_uint<BUS_ADDR_WIDTH>> i_resp_mem_addr; // Memory response address
22
    sc_in<sc_uint<32>> i_resp_mem_data; // Memory response value
23
    sc_in<bool> i_f_predic_miss;        // Fetch modul detects deviation between predicted and valid pc.
24
    sc_in<sc_uint<32>> i_e_npc;         // Valid instruction value awaited by 'Executor'
25
    sc_in<sc_uint<RISCV_ARCH>> i_ra;    // Return address register value
26
    sc_out<sc_uint<32>> o_npc_predict;  // Predicted next instruction address
27
 
28
    void comb();
29
    void registers();
30
 
31
    SC_HAS_PROCESS(BranchPredictor);
32
 
33
    BranchPredictor(sc_module_name name_);
34
 
35
    void generateVCD(sc_trace_file *i_vcd, sc_trace_file *o_vcd);
36
 
37
private:
38
    struct RegistersType {
39
        sc_signal<sc_uint<BUS_ADDR_WIDTH>> npc;
40
    } v, r;
41
    sc_signal<sc_uint<BUS_ADDR_WIDTH>> wb_npc;
42
};
43
 
44
 
45
}  // namespace debugger
46
 
47
#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.