Repository navigation
Expand file tree
/
Copy pathtex_core.h
More file actions
70 lines (54 loc) · 1.94 KB
/
Copy pathtex_core.h
File metadata and controls
70 lines (54 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright © 2019-2023
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <memory>
#include "types.h"
#include "tex_unit.h"
namespace vortex {
class Socket;
// Socket-resident TEX engine: socket-level arbitration feeds the texture
// address/memory/sampler pipeline. All texel reads flow through the tcache
// via MemReq/MemRsp; functional and timing are resolved at MemRsp arrival.
class TexCore : public SimObject<TexCore> {
public:
using Ptr = std::shared_ptr<TexCore>;
struct PerfStats {
uint64_t mem_reads = 0;
uint64_t mem_latency = 0;
uint64_t stall_cycles = 0;
PerfStats& operator+=(const PerfStats& rhs) {
mem_reads += rhs.mem_reads;
mem_latency += rhs.mem_latency;
stall_cycles += rhs.stall_cycles;
return *this;
}
};
// Inputs from the per-socket TexBus arbiter; size = VX_CFG_NUM_TEX_CORES.
std::vector<SimChannel<TexReq>> tex_req_in;
std::vector<SimChannel<TexRsp>> tex_rsp_out;
// Memory ports to the tcache. Size = TCACHE_NUM_REQS.
std::vector<SimChannel<MemReq>> tcache_req_out;
std::vector<SimChannel<MemRsp>> tcache_rsp_in;
TexCore(const SimContext& ctx, const char* name, Socket* socket);
virtual ~TexCore();
int dcr_write(uint32_t addr, uint32_t value);
const PerfStats& perf_stats() const;
protected:
void on_reset();
void on_tick();
private:
class Impl;
Impl* impl_;
friend class SimObject<TexCore>;
};
} // namespace vortex