1/*
2 * Copyright (c) 2016 RISC-V Foundation
3 * Copyright (c) 2016 The University of Virginia
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
8 * met: redistributions of source code must retain the above copyright

--- 98 unchanged lines hidden (view full) ---

107 miscRegFile[misc_reg]);
108 return miscRegFile[misc_reg];
109}
110
111RegVal
112ISA::readMiscReg(int misc_reg, ThreadContext *tc)
113{
114 switch (misc_reg) {
115 case MISCREG_HARTID:
116 return tc->contextId();
117 case MISCREG_CYCLE:
118 if (hpmCounterEnabled(MISCREG_CYCLE)) {
119 DPRINTF(RiscvMisc, "Cycle counter at: %llu.\n",
120 tc->getCpuPtr()->curCycle());
121 return tc->getCpuPtr()->curCycle();
122 } else {
123 warn("Cycle counter disabled.\n");
124 return 0;

--- 81 unchanged lines hidden ---