Skip to content

Commit 99eaaf6

Browse files
committed
uuid_gen cleanup
1 parent fa5590b commit 99eaaf6

File tree

8 files changed

+14
-79
lines changed

8 files changed

+14
-79
lines changed

hw/dpi/util_dpi.cpp

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
#include "svdpi.h"
2222
#include "verilated_vpi.h"
2323

24-
#include "uuid_gen.h"
25-
2624
#ifdef XLEN_64
2725
#define iword_t int64_t
2826
#define uword_t uint64_t
@@ -50,7 +48,7 @@ extern "C" {
5048
void dpi_trace_start();
5149
void dpi_trace_stop();
5250

53-
uint64_t dpi_uuid_gen(bool reset, int wid, uint64_t PC);
51+
uint64_t dpi_uuid_gen(bool reset, int wid);
5452
}
5553

5654
bool sim_trace_enabled();
@@ -209,22 +207,14 @@ void dpi_trace_stop() {
209207

210208
///////////////////////////////////////////////////////////////////////////////
211209

212-
std::unordered_map<uint32_t, std::shared_ptr<vortex::UUIDGenerator>> g_uuid_gens;
210+
std::unordered_map<uint32_t, uint32_t> g_uuid_gens;
213211

214-
uint64_t dpi_uuid_gen(bool reset, int wid, uint64_t PC) {
212+
uint64_t dpi_uuid_gen(bool reset, int wid) {
215213
if (reset) {
216214
g_uuid_gens.clear();
217215
return 0;
218216
}
219-
std::shared_ptr<vortex::UUIDGenerator> uuid_gen;
220-
auto it = g_uuid_gens.find(wid);
221-
if (it == g_uuid_gens.end()) {
222-
uuid_gen = std::make_shared<vortex::UUIDGenerator>();
223-
g_uuid_gens.emplace(wid, uuid_gen);
224-
} else {
225-
uuid_gen = it->second;
226-
}
227-
uint32_t instr_uuid = uuid_gen->get_uuid(PC);
217+
uint32_t instr_uuid = g_uuid_gens[wid]++;
228218
uint64_t uuid = (uint64_t(wid) << 32) | instr_uuid;
229219
return uuid;
230220
}

hw/dpi/util_dpi.vh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Copyright © 2019-2023
2-
//
2+
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
55
// You may obtain a copy of the License at
66
// http://www.apache.org/licenses/LICENSE-2.0
7-
//
7+
//
88
// Unless required by applicable law or agreed to in writing, software
99
// distributed under the License is distributed on an "AS IS" BASIS,
1010
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,6 +32,6 @@ import "DPI-C" function void dpi_trace(input int level, input string format /*ve
3232
import "DPI-C" function void dpi_trace_start();
3333
import "DPI-C" function void dpi_trace_stop();
3434

35-
import "DPI-C" function longint dpi_uuid_gen(input logic reset, input int wid, input longint PC);
35+
import "DPI-C" function longint dpi_uuid_gen(input logic reset, input int wid);
3636

3737
`endif

hw/rtl/core/VX_schedule.sv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,9 @@ module VX_schedule import VX_gpu_pkg::*; #(
338338
`ifdef SV_DPI
339339
always @(posedge clk) begin
340340
if (reset) begin
341-
instr_uuid <= `UUID_WIDTH'(dpi_uuid_gen(1, 0, 0));
341+
instr_uuid <= `UUID_WIDTH'(dpi_uuid_gen(1, 32'd0));
342342
end else if (schedule_fire) begin
343-
instr_uuid <= `UUID_WIDTH'(dpi_uuid_gen(0, 32'(g_wid), 64'(schedule_pc)));
343+
instr_uuid <= `UUID_WIDTH'(dpi_uuid_gen(0, 32'(g_wid)));
344344
end
345345
end
346346
`else

hw/rtl/core/VX_trace.vh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@
303303
end
304304
`INST_FPU_MISC: begin
305305
if (op_args.fpu.fmt[0]) begin
306-
case (op_args)
306+
case (op_args.fpu.frm)
307307
0: `TRACE(level, ("FSGNJ.D"));
308308
1: `TRACE(level, ("FSGNJN.D"));
309309
2: `TRACE(level, ("FSGNJX.D"));
@@ -314,7 +314,7 @@
314314
7: `TRACE(level, ("FMAX.D"));
315315
endcase
316316
end else begin
317-
case (op_args)
317+
case (op_args.fpu.frm)
318318
0: `TRACE(level, ("FSGNJ.S"));
319319
1: `TRACE(level, ("FSGNJN.S"));
320320
2: `TRACE(level, ("FSGNJX.S"));

sim/common/uuid_gen.h

Lines changed: 0 additions & 55 deletions
This file was deleted.

sim/simx/emulator.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Emulator::ipdom_entry_t::ipdom_entry_t(const ThreadMask &tmask)
4444
Emulator::warp_t::warp_t(const Arch& arch)
4545
: ireg_file(arch.num_threads(), std::vector<Word>(arch.num_regs()))
4646
, freg_file(arch.num_threads(), std::vector<uint64_t>(arch.num_regs()))
47+
, uuid(0)
4748
{}
4849

4950
void Emulator::warp_t::clear(uint64_t startup_addr) {
@@ -153,7 +154,7 @@ instr_trace_t* Emulator::step() {
153154
assert(warp.tmask.any());
154155

155156
#ifndef NDEBUG
156-
uint32_t instr_uuid = warp.uui_gen.get_uuid(warp.PC);
157+
uint32_t instr_uuid = warp.uuid++;
157158
uint32_t g_wid = core_->id() * arch_.num_warps() + scheduled_warp;
158159
uint64_t uuid = (uint64_t(g_wid) << 32) | instr_uuid;
159160
#else

sim/simx/emulator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class Emulator {
7575
std::vector<std::vector<uint64_t>>freg_file;
7676
std::stack<ipdom_entry_t> ipdom_stack;
7777
Byte fcsr;
78-
UUIDGenerator uui_gen;
78+
uint32_t uuid;
7979
};
8080

8181
struct wspawn_t {

sim/simx/types.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include <stringutil.h>
2323
#include <VX_config.h>
2424
#include <simobject.h>
25-
#include "uuid_gen.h"
2625
#include "debug.h"
2726

2827
namespace vortex {

0 commit comments

Comments
 (0)