Monero
Loading...
Searching...
No Matches
superscalar_program.hpp
Go to the documentation of this file.
1/*
2Copyright (c) 2018-2019, tevador <tevador@gmail.com>
3
4All rights reserved.
5
6Redistribution and use in source and binary forms, with or without
7modification, 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
17THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26OF 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
35namespace randomx {
36
38 public:
40 return programBuffer[pc];
41 }
42 friend std::ostream& operator<<(std::ostream& os, const SuperscalarProgram& p) {
43 p.print(os);
44 return os;
45 }
47 return size;
48 }
49 void setSize(uint32_t val) {
50 size = val;
51 }
53 return addrReg;
54 }
55 void setAddressRegister(int val) {
56 addrReg = val;
57 }
58
61#ifndef NDEBUG
62 = 0
63#endif
64 ;
66 double ipc;
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}
Definition instruction.hpp:75
Definition superscalar_program.hpp:37
friend std::ostream & operator<<(std::ostream &os, const SuperscalarProgram &p)
Definition superscalar_program.hpp:42
uint32_t size
Definition superscalar_program.hpp:62
uint32_t getSize()
Definition superscalar_program.hpp:46
void setSize(uint32_t val)
Definition superscalar_program.hpp:49
int asicLatencies[8]
Definition superscalar_program.hpp:74
Instruction & operator()(int pc)
Definition superscalar_program.hpp:39
int cpuLatencies[8]
Definition superscalar_program.hpp:73
int macroOps
Definition superscalar_program.hpp:68
int cpuLatency
Definition superscalar_program.hpp:70
double ipc
Definition superscalar_program.hpp:66
int asicLatency
Definition superscalar_program.hpp:71
int decodeCycles
Definition superscalar_program.hpp:69
int mulCount
Definition superscalar_program.hpp:72
Instruction programBuffer[SuperscalarMaxSize]
Definition superscalar_program.hpp:59
int getAddressRegister()
Definition superscalar_program.hpp:52
void setAddressRegister(int val)
Definition superscalar_program.hpp:55
void print(std::ostream &os) const
Definition superscalar_program.hpp:76
int codeSize
Definition superscalar_program.hpp:67
int addrReg
Definition superscalar_program.hpp:65
Definition allocator.cpp:35
constexpr int SuperscalarMaxSize
Definition common.hpp:81
unsigned int uint32_t
Definition stdint.h:126