Skip to content

Commit fe96843

Browse files
committed
Adapt VirtualPrototype to use project Makefile
Change address map to work with VirtualPrototype
1 parent 2b04bc2 commit fe96843

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+17263
-70
lines changed

modules/VirtualPrototype/Makefile

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Include common Makefile
2+
include ../Makefile
3+
4+
# Defining preprocessor directive for debug
5+
ifdef IPS_DEBUG_EN
6+
CFLAGS += -DIPS_DEBUG_EN
7+
LFLAGS += -DIPS_DEBUG_EN
8+
endif # IPS_DEBUG_EN
9+
10+
# Defining preprocessor directive for dumping enable
11+
ifdef IPS_DUMP_EN
12+
CFLAGS += -DIPS_DUMP_EN
13+
LFLAGS += -DIPS_DUMP_EN
14+
endif # IPS_DUMP_EN
15+
16+
# Defining preprocessor directive for normalizing the resulting magnitude
17+
ifdef TEST_NORMALIZE_MAGNITUDE
18+
CFLAGS += -DTEST_NORMALIZE_MAGNITUDE
19+
LFLAGS += -DTEST_NORMALIZE_MAGNITUDE
20+
endif # TEST_NORMALIZE_MAGNITUDE
21+
22+
# Defining preprocessor directive for using PV model
23+
ifdef RGB2GRAY_PV_EN
24+
CFLAGS += -DRGB2GRAY_PV_EN
25+
LFLAGS += -DRGB2GRAY_PV_EN
26+
endif # RGB2GRAY_PV_EN
27+
28+
ifdef EDGE_DETECTOR_PV_EN
29+
CFLAGS += -DEDGE_DETECTOR_PV_EN
30+
LFLAGS += -DEDGE_DETECTOR_PV_EN
31+
endif # EDGE_DETECTOR_PV_EN
32+
33+
# Defining preprocessor directive for using PV model
34+
ifdef EDGE_DETECTOR_LT_EN
35+
CFLAGS += -DEDGE_DETECTOR_LT_EN
36+
LFLAGS += -DEDGE_DETECTOR_LT_EN
37+
endif # EDGE_DETECTOR_LT_EN
38+
39+
# Defining preprocessor directive for using PV model
40+
ifdef EDGE_DETECTOR_AT_EN
41+
CFLAGS += -DEDGE_DETECTOR_AT_EN
42+
LFLAGS += -DEDGE_DETECTOR_AT_EN
43+
endif # EDGE_DETECTOR_AT_EN
44+
45+
ifdef USING_TLM_TB_EN
46+
CFLAGS += -DUSING_TLM_TB_EN
47+
LFLAGS += -DUSING_TLM_TB_EN
48+
endif # USING_TLM_TB_EN
49+
50+
ifdef IPS_FILTER_LT_EN
51+
CFLAGS += -DIPS_FILTER_LT_EN
52+
LFLAGS += -DIPS_FILTER_LT_EN
53+
endif # IPS_FILTER_LT_EN
54+
55+
ifdef IMG_UNIFICATE_PV_EN
56+
CFLAGS += -DIMG_UNIFICATE_PV_EN
57+
LFLAGS += -DIMG_UNIFICATE_PV_EN
58+
endif # UNIFICATE_PV_EN
59+
60+
ifdef USING_TLM_ROUTER_TB_EN
61+
CFLAGS += -DUSING_TLM_ROUTER_TB_EN
62+
LFLAGS += -DUSING_TLM_ROUTER_TB_EN
63+
endif # USING_TLM_TB_EN
64+
65+
ifdef IPS_JPG_PV_EN
66+
CFLAGS += -DIPS_JPG_PV_EN
67+
LFLAGS += -DIPS_JPG_PV_EN
68+
endif # IPS_JPG_PV_EN
69+
70+
ifdef USING_RISCV_TLM_TB_EN
71+
CFLAGS += -DUSING_RISCV_TLM_TB_EN
72+
LFLAGS += -DUSING_RISCV_TLM_TB_EN
73+
endif # USING_RISCV_TLM_TB_EN
74+
75+
.PHONY: print-all
76+
print-all:
77+
@echo "Incdir is $(INCDIR)"
78+
@echo "Srcdir is $(SRCDIR)"
79+
@echo "Srcdirs are $(SRCDIRS)"
80+
@echo "Includes are $(INCLUDES)"
81+
@echo "Sources are $(SOURCES)"
82+
@echo "Objects are $(OBJECTS)"
83+
84+
.PHONY: print-flags
85+
print-flags:
86+
@echo "Flags are $(CFLAGS)"
87+
88+
# Run the compiled file
89+
run:
90+
@./test
91+
92+
# Show waveform
93+
waveform:
94+
@gtkwave router.vcd

modules/VirtualPrototype/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# **Communication Module**
2+
3+
Add compilation instructions
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
/*!
2+
\file A_extension.h
3+
\brief Implement A extensions part of the RISC-V
4+
\author Màrius Montón
5+
\date December 2018
6+
*/
7+
// SPDX-License-Identifier: GPL-3.0-or-later
8+
9+
#ifndef A_EXTENSION__H
10+
#define A_EXTENSION__H
11+
12+
#include "systemc"
13+
14+
#include <unordered_set>
15+
16+
#include "Log.h"
17+
#include "Registers.h"
18+
#include "MemoryInterface.h"
19+
#include "extension_base.h"
20+
21+
typedef enum {
22+
OP_A_LR,
23+
OP_A_SC,
24+
OP_A_AMOSWAP,
25+
OP_A_AMOADD,
26+
OP_A_AMOXOR,
27+
OP_A_AMOAND,
28+
OP_A_AMOOR,
29+
OP_A_AMOMIN,
30+
OP_A_AMOMAX,
31+
OP_A_AMOMINU,
32+
OP_A_AMOMAXU,
33+
34+
OP_A_ERROR
35+
} op_A_Codes;
36+
37+
typedef enum {
38+
A_LR = 0b00010,
39+
A_SC = 0b00011,
40+
A_AMOSWAP = 0b00001,
41+
A_AMOADD = 0b00000,
42+
A_AMOXOR = 0b00100,
43+
A_AMOAND = 0b01100,
44+
A_AMOOR = 0b01000,
45+
A_AMOMIN = 0b10000,
46+
A_AMOMAX = 0b10100,
47+
A_AMOMINU = 0b11000,
48+
A_AMOMAXU = 0b11100,
49+
} A_Codes;
50+
51+
/**
52+
* @brief Instruction decoding and fields access
53+
*/
54+
class A_extension: public extension_base {
55+
public:
56+
57+
/**
58+
* @brief Constructor, same as base class
59+
*/
60+
using extension_base::extension_base;
61+
62+
/**
63+
* @brief Access to opcode field
64+
* @return return opcode field
65+
*/
66+
inline int32_t opcode() const override {
67+
return m_instr.range(31, 27);
68+
}
69+
70+
/**
71+
* @brief Decodes opcode of instruction
72+
* @return opcode of instruction
73+
*/
74+
op_A_Codes decode() const;
75+
76+
inline void dump() const override {
77+
std::cout << std::hex << "0x" << m_instr << std::dec << std::endl;
78+
}
79+
80+
bool Exec_A_LR();
81+
bool Exec_A_SC();
82+
bool Exec_A_AMOSWAP() const;
83+
bool Exec_A_AMOADD() const;
84+
bool Exec_A_AMOXOR() const;
85+
bool Exec_A_AMOAND() const;
86+
bool Exec_A_AMOOR() const;
87+
bool Exec_A_AMOMIN() const;
88+
bool Exec_A_AMOMAX() const;
89+
bool Exec_A_AMOMINU() const;
90+
bool Exec_A_AMOMAXU() const;
91+
92+
bool process_instruction(Instruction *inst);
93+
94+
void TLB_reserve(uint32_t address);
95+
bool TLB_reserved(uint32_t address);
96+
97+
private:
98+
std::unordered_set<uint32_t> TLB_A_Entries;
99+
};
100+
101+
#endif

0 commit comments

Comments
 (0)