Monero
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 
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  ;
65  int addrReg;
66  double ipc;
67  int codeSize;
68  int macroOps;
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 }
int asicLatencies[8]
Definition: superscalar_program.hpp:74
Definition: allocator.cpp:35
int i
Definition: pymoduletest.py:23
Instruction programBuffer[SuperscalarMaxSize]
Definition: superscalar_program.hpp:59
void setAddressRegister(int val)
Definition: superscalar_program.hpp:55
int codeSize
Definition: superscalar_program.hpp:67
Definition: instruction.hpp:75
Definition: superscalar_program.hpp:37
int cpuLatency
Definition: superscalar_program.hpp:70
uint32_t size
Definition: superscalar_program.hpp:62
Instruction & operator()(int pc)
Definition: superscalar_program.hpp:39
unsigned int uint32_t
Definition: stdint.h:126
constexpr int SuperscalarMaxSize
Definition: common.hpp:81
void print(std::ostream &os) const
Definition: superscalar_program.hpp:76
int cpuLatencies[8]
Definition: superscalar_program.hpp:73
int mulCount
Definition: superscalar_program.hpp:72
int macroOps
Definition: superscalar_program.hpp:68
double ipc
Definition: superscalar_program.hpp:66
int getAddressRegister()
Definition: superscalar_program.hpp:52
void setSize(uint32_t val)
Definition: superscalar_program.hpp:49
p
Definition: pymoduletest.py:75
int asicLatency
Definition: superscalar_program.hpp:71
friend std::ostream & operator<<(std::ostream &os, const SuperscalarProgram &p)
Definition: superscalar_program.hpp:42
int addrReg
Definition: superscalar_program.hpp:65
uint32_t getSize()
Definition: superscalar_program.hpp:46
int decodeCycles
Definition: superscalar_program.hpp:69