Monero
Toggle main menu visibility
Loading...
Searching...
No Matches
external
randomx
src
superscalar_program.hpp
Go to the documentation of this file.
1
/*
2
Copyright (c) 2018-2019, tevador <tevador@gmail.com>
3
4
All rights reserved.
5
6
Redistribution and use in source and binary forms, with or without
7
modification, are permitted provided that the following conditions are met:
8
* Redistributions of source code must retain the above copyright
9
notice, this list of conditions and the following disclaimer.
10
* Redistributions in binary form must reproduce the above copyright
11
notice, this list of conditions and the following disclaimer in the
12
documentation and/or other materials provided with the distribution.
13
* Neither the name of the copyright holder nor the
14
names of its contributors may be used to endorse or promote products
15
derived from this software without specific prior written permission.
16
17
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
*/
28
29
#pragma once
30
31
#include <cstdint>
32
#include "
instruction.hpp
"
33
#include "
common.hpp
"
34
35
namespace
randomx
{
36
37
class
SuperscalarProgram
{
38
public
:
39
Instruction
&
operator()
(
int
pc) {
40
return
programBuffer
[pc];
41
}
42
friend
std::ostream&
operator<<
(std::ostream& os,
const
SuperscalarProgram
& p) {
43
p.print(os);
44
return
os;
45
}
46
uint32_t
getSize
() {
47
return
size
;
48
}
49
void
setSize
(
uint32_t
val) {
50
size
= val;
51
}
52
int
getAddressRegister
() {
53
return
addrReg
;
54
}
55
void
setAddressRegister
(
int
val) {
56
addrReg
= val;
57
}
58
59
Instruction
programBuffer
[
SuperscalarMaxSize
];
60
uint32_t
size
61
#ifndef NDEBUG
62
= 0
63
#endif
64
;
65
int
addrReg
;
66
double
ipc
;
67
int
codeSize
;
68
int
macroOps
;
69
int
decodeCycles
;
70
int
cpuLatency
;
71
int
asicLatency
;
72
int
mulCount
;
73
int
cpuLatencies
[8];
74
int
asicLatencies
[8];
75
private
:
76
void
print
(std::ostream& os)
const
{
77
for
(
unsigned
i = 0; i <
size
; ++i) {
78
auto
instr =
programBuffer
[i];
79
os << instr;
80
}
81
}
82
};
83
84
}
randomx::Instruction
Definition
instruction.hpp:75
randomx::SuperscalarProgram
Definition
superscalar_program.hpp:37
randomx::SuperscalarProgram::operator<<
friend std::ostream & operator<<(std::ostream &os, const SuperscalarProgram &p)
Definition
superscalar_program.hpp:42
randomx::SuperscalarProgram::size
uint32_t size
Definition
superscalar_program.hpp:62
randomx::SuperscalarProgram::getSize
uint32_t getSize()
Definition
superscalar_program.hpp:46
randomx::SuperscalarProgram::setSize
void setSize(uint32_t val)
Definition
superscalar_program.hpp:49
randomx::SuperscalarProgram::asicLatencies
int asicLatencies[8]
Definition
superscalar_program.hpp:74
randomx::SuperscalarProgram::operator()
Instruction & operator()(int pc)
Definition
superscalar_program.hpp:39
randomx::SuperscalarProgram::cpuLatencies
int cpuLatencies[8]
Definition
superscalar_program.hpp:73
randomx::SuperscalarProgram::macroOps
int macroOps
Definition
superscalar_program.hpp:68
randomx::SuperscalarProgram::cpuLatency
int cpuLatency
Definition
superscalar_program.hpp:70
randomx::SuperscalarProgram::ipc
double ipc
Definition
superscalar_program.hpp:66
randomx::SuperscalarProgram::asicLatency
int asicLatency
Definition
superscalar_program.hpp:71
randomx::SuperscalarProgram::decodeCycles
int decodeCycles
Definition
superscalar_program.hpp:69
randomx::SuperscalarProgram::mulCount
int mulCount
Definition
superscalar_program.hpp:72
randomx::SuperscalarProgram::programBuffer
Instruction programBuffer[SuperscalarMaxSize]
Definition
superscalar_program.hpp:59
randomx::SuperscalarProgram::getAddressRegister
int getAddressRegister()
Definition
superscalar_program.hpp:52
randomx::SuperscalarProgram::setAddressRegister
void setAddressRegister(int val)
Definition
superscalar_program.hpp:55
randomx::SuperscalarProgram::print
void print(std::ostream &os) const
Definition
superscalar_program.hpp:76
randomx::SuperscalarProgram::codeSize
int codeSize
Definition
superscalar_program.hpp:67
randomx::SuperscalarProgram::addrReg
int addrReg
Definition
superscalar_program.hpp:65
common.hpp
instruction.hpp
randomx
Definition
allocator.cpp:35
randomx::SuperscalarMaxSize
constexpr int SuperscalarMaxSize
Definition
common.hpp:81
uint32_t
unsigned int uint32_t
Definition
stdint.h:126
Generated on
for Monero by
1.17.0