Skip to content

Commit

Permalink
Use tallocator for fast multicode memory allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
puneet committed Jan 9, 2024
1 parent 4f4482f commit fcafde9
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions euvm/riscv/gen/riscv_instr_registry.d
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import std.algorithm.sorting: sort;
import std.traits: EnumMembers;

import esdl.base.rand: urandom;
import esdl.experimental.allocator.mallocator: Mallocator;
import esdl.experimental.allocator.tallocator: Tallocator;
import std.container.array: Array;
import esdl.data.vector: Vector;

Expand All @@ -57,6 +57,7 @@ class riscv_instr_registry: uvm_object
riscv_instr[riscv_instr_name_t] instr_template;

riscv_instr_gen_config cfg;
static Tallocator!(1024*1024) tallocator;

this (string name="") {
super(name);
Expand Down Expand Up @@ -272,8 +273,8 @@ class riscv_instr_registry: uvm_object
name = inter_set[idx];
}
// Shallow copy for all relevant fields, avoid using create() to improve performance
// auto instr = instr_template[name].dup(Mallocator.instance);
auto instr = instr_template[name].dup();
auto instr = instr_template[name].dup(tallocator);
// auto instr = instr_template[name].dup();
instr.m_cfg = cfg;
return instr;
}
Expand Down Expand Up @@ -301,8 +302,8 @@ class riscv_instr_registry: uvm_object
ulong idx = urandom( 0, load_store_instr.length);
riscv_instr_name_t name = load_store_instr[idx];
// Shallow copy for all relevant fields, avoid using create() to improve performance
// auto instr = instr_template[name].dup(Mallocator.instance);
auto instr = instr_template[name].dup();
auto instr = instr_template[name].dup(tallocator);
// auto instr = instr_template[name].dup();
instr.m_cfg = cfg;
return instr;
}
Expand All @@ -312,8 +313,8 @@ class riscv_instr_registry: uvm_object
uvm_fatal("riscv_instr", format("Cannot get instr %0s", name));
}
// Shallow copy for all relevant fields, avoid using create() to improve performance
// auto instr = instr_template[name].dup(Mallocator.instance);
auto instr = instr_template[name].dup();
auto instr = instr_template[name].dup(tallocator);
// auto instr = instr_template[name].dup();
instr.m_cfg = cfg;
return instr;
}
Expand Down

0 comments on commit fcafde9

Please sign in to comment.