gem5 v24.0.0.0
Loading...
Searching...
No Matches
amdgpu_gfx.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Advanced Micro Devices, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its
16 * contributors may be used to endorse or promote products derived from this
17 * software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
33
34#include "mem/packet_access.hh"
35#include "sim/core.hh"
36
37namespace gem5
38{
39
41{
42 for (int i = 0; i < SCRATCH_REGS; ++i) {
43 scratchRegs[i] = 0;
44 }
45}
46
47void
49{
50 switch (offset) {
52 pkt->setLE<uint32_t>(captured_clock_count);
53 break;
55 pkt->setLE<uint32_t>(captured_clock_count >> 32);
56 break;
58 pkt->setLE<uint32_t>(scratchRegs[0]);
59 break;
60 default:
61 break;
62 }
63}
64
65void
67{
68 switch (offset) {
70 // Use gem5 Ticks in nanoseconds are the counter. The first capture
71 // is expected to return zero.
72 if (captured_clock_count == 1) {
74 } else {
76 }
77 break;
79 scratchRegs[0] = pkt->getLE<uint32_t>();
80 break;
81 default:
82 break;
83 }
84}
85
86} // namespace gem5
#define AMDGPU_MM_RLC_GPU_CLOCK_COUNT_MSB
Definition amdgpu_gfx.hh:52
#define AMDGPU_MM_SCRATCH_REG0
Definition amdgpu_gfx.hh:56
#define AMDGPU_MM_RLC_GPU_CLOCK_COUNT_LSB
MMIO offsets for GFX.
Definition amdgpu_gfx.hh:51
#define AMDGPU_MM_RLC_CAPTURE_GPU_CLOCK_COUNT
Definition amdgpu_gfx.hh:53
static constexpr int SCRATCH_REGS
Definition amdgpu_gfx.hh:78
std::array< uint32_t, SCRATCH_REGS > scratchRegs
Definition amdgpu_gfx.hh:79
void readMMIO(PacketPtr pkt, Addr offset)
Definition amdgpu_gfx.cc:48
void writeMMIO(PacketPtr pkt, Addr offset)
Definition amdgpu_gfx.cc:66
uint64_t captured_clock_count
Definition amdgpu_gfx.hh:73
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
void setLE(T v)
Set the value in the data pointer to v as little endian.
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
Bitfield< 7 > i
Definition misc_types.hh:67
Bitfield< 23, 0 > offset
Definition types.hh:144
Tick ns
nanosecond
Definition core.cc:68
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
Tick curTick()
The universal simulation clock.
Definition cur_tick.hh:46
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147

Generated on Tue Jun 18 2024 16:24:02 for gem5 by doxygen 1.11.0