ChampSim
trace_instruction.h
Go to the documentation of this file.
1 /*
2  * Copyright 2023 The ChampSim Contributors
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  */
16 
17 #ifndef TRACE_INSTRUCTION_H
18 #define TRACE_INSTRUCTION_H
19 
20 #include <limits>
21 
22 // special registers that help us identify branches
23 namespace champsim
24 {
25 constexpr char REG_STACK_POINTER = 6;
26 constexpr char REG_FLAGS = 25;
27 constexpr char REG_INSTRUCTION_POINTER = 26;
28 } // namespace champsim
29 
30 // instruction format
31 constexpr std::size_t NUM_INSTR_DESTINATIONS_SPARC = 4;
32 constexpr std::size_t NUM_INSTR_DESTINATIONS = 2;
33 constexpr std::size_t NUM_INSTR_SOURCES = 4;
34 
35 struct input_instr {
36  // instruction pointer or PC (Program Counter)
37  unsigned long long ip;
38 
39  // branch info
40  unsigned char is_branch;
41  unsigned char branch_taken;
42 
43  unsigned char destination_registers[NUM_INSTR_DESTINATIONS]; // output registers
44  unsigned char source_registers[NUM_INSTR_SOURCES]; // input registers
45 
46  unsigned long long destination_memory[NUM_INSTR_DESTINATIONS]; // output memory
47  unsigned long long source_memory[NUM_INSTR_SOURCES]; // input memory
48 };
49 
51  // instruction pointer or PC (Program Counter)
52  unsigned long long ip;
53 
54  // branch info
55  unsigned char is_branch;
56  unsigned char branch_taken;
57 
58  unsigned char destination_registers[NUM_INSTR_DESTINATIONS_SPARC]; // output registers
59  unsigned char source_registers[NUM_INSTR_SOURCES]; // input registers
60 
61  unsigned long long destination_memory[NUM_INSTR_DESTINATIONS_SPARC]; // output memory
62  unsigned long long source_memory[NUM_INSTR_SOURCES]; // input memory
63 
64  unsigned char asid[2];
65 };
66 
67 #endif
Definition: champsim.h:24
constexpr char REG_STACK_POINTER
Definition: trace_instruction.h:25
constexpr char REG_INSTRUCTION_POINTER
Definition: trace_instruction.h:27
constexpr char REG_FLAGS
Definition: trace_instruction.h:26
Definition: trace_instruction.h:50
unsigned long long source_memory[NUM_INSTR_SOURCES]
Definition: trace_instruction.h:62
unsigned char asid[2]
Definition: trace_instruction.h:64
unsigned long long ip
Definition: trace_instruction.h:52
unsigned char is_branch
Definition: trace_instruction.h:55
unsigned char source_registers[NUM_INSTR_SOURCES]
Definition: trace_instruction.h:59
unsigned char branch_taken
Definition: trace_instruction.h:56
unsigned long long destination_memory[NUM_INSTR_DESTINATIONS_SPARC]
Definition: trace_instruction.h:61
unsigned char destination_registers[NUM_INSTR_DESTINATIONS_SPARC]
Definition: trace_instruction.h:58
Definition: trace_instruction.h:35
unsigned char is_branch
Definition: trace_instruction.h:40
unsigned long long destination_memory[NUM_INSTR_DESTINATIONS]
Definition: trace_instruction.h:46
unsigned long long ip
Definition: trace_instruction.h:37
unsigned char source_registers[NUM_INSTR_SOURCES]
Definition: trace_instruction.h:44
unsigned long long source_memory[NUM_INSTR_SOURCES]
Definition: trace_instruction.h:47
unsigned char branch_taken
Definition: trace_instruction.h:41
unsigned char destination_registers[NUM_INSTR_DESTINATIONS]
Definition: trace_instruction.h:43
constexpr std::size_t NUM_INSTR_SOURCES
Definition: trace_instruction.h:33
constexpr std::size_t NUM_INSTR_DESTINATIONS
Definition: trace_instruction.h:32
constexpr std::size_t NUM_INSTR_DESTINATIONS_SPARC
Definition: trace_instruction.h:31