From 0464b7765aa4d1fc2178e443a3b37d19cfe541a0 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sun, 2 Mar 2025 21:45:51 +0200 Subject: add ideal allocation tracker + Kind of like CHERI, but uses out-of-line pointer information. The idea is that a core that is compatible with ALLOC_IF queries the allocation tracker if an address is legal and gets a response. This ideal tracker effectively has infinite memory and doesn't talk to any other components, but a real implementation might want to limit the allocations per process or chat with some reserved memory region somewhere else in the system to maintain a binary tree or something. --- tests/simple_ideal_alloc/sim.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/simple_ideal_alloc/sim.c (limited to 'tests/simple_ideal_alloc/sim.c') diff --git a/tests/simple_ideal_alloc/sim.c b/tests/simple_ideal_alloc/sim.c new file mode 100644 index 0000000..6aeb5b6 --- /dev/null +++ b/tests/simple_ideal_alloc/sim.c @@ -0,0 +1,26 @@ +#include + +#include +#include + +#include "testbench.h" + +int main() +{ + struct component *traffic_gen = create_testbench(); + struct component *ideal_alloc = create_ideal_alloc(1); + + ideal_alloc_connect(ideal_alloc, traffic_gen); + testbench_connect(traffic_gen, ideal_alloc); + + struct clock_domain *clk = create_clock_domain(NS(1)); + clock_domain_add(clk, traffic_gen); + clock_domain_add(clk, ideal_alloc); + + struct gran_root *root = create_root(); + root_add_clock(root, clk); + + assert(root_run(root) == OK); + + destroy_root(root); +} -- cgit v1.3