Skip to content

Commit

Permalink
Merge branch 'master' into asm-linker
Browse files Browse the repository at this point in the history
  • Loading branch information
piotro888 authored Nov 24, 2023
2 parents 4d7cecc + 964065c commit e4202c9
Show file tree
Hide file tree
Showing 14 changed files with 108 additions and 16 deletions.
5 changes: 0 additions & 5 deletions docs/Current_graph.md

This file was deleted.

File renamed without changes.
12 changes: 12 additions & 0 deletions docs/current-graph.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Full transaction-method graph

<div style="overflow: scroll; white-space: nowrap">
<div style="width: 2000%; height: 2000%">

```{eval-rst}
.. include:: auto_graph.rst
```

</div>
</div>
File renamed without changes.
File renamed without changes.
22 changes: 11 additions & 11 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
maxdepth: 3
---
Home.md
Assumptions.md
Development_environment.md
Transactions.md
scheduler/Overview.md
shared_structs/Implementation/RS_impl.md
shared_structs/RS.md
Current_graph.md
Problem-checklist.md
synthesis/Synthesis.md
home.md
assumptions.md
development-environment.md
transactions.md
scheduler/overview.md
shared-structs/implementation/rs-impl.md
shared-structs/rs.md
current-graph.md
problem-checklist.md
synthesis/synthesis.md
components/icache.md
miscellany/exceptionsSummary.md
miscellany/exceptions-summary.md
api.md
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
85 changes: 85 additions & 0 deletions test/structs_common/test_rat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
from ..common import TestCaseWithSimulator, SimpleTestCircuit

from coreblocks.structs_common.rat import FRAT, RRAT
from coreblocks.params import GenParams
from coreblocks.params.configurations import test_core_config

from collections import deque
from random import Random


class TestFrontendRegisterAliasTable(TestCaseWithSimulator):
def gen_input(self):
for _ in range(self.test_steps):
rl = self.rand.randrange(self.gen_params.isa.reg_cnt)
rp = self.rand.randrange(1, 2**self.gen_params.phys_regs_bits) if rl != 0 else 0
rl_s1 = self.rand.randrange(self.gen_params.isa.reg_cnt)
rl_s2 = self.rand.randrange(self.gen_params.isa.reg_cnt)

self.to_execute_list.append({"rl": rl, "rp": rp, "rl_s1": rl_s1, "rl_s2": rl_s2})

def do_rename(self):
for _ in range(self.test_steps):
to_execute = self.to_execute_list.pop()
res = yield from self.m.rename.call(
rl_dst=to_execute["rl"], rp_dst=to_execute["rp"], rl_s1=to_execute["rl_s1"], rl_s2=to_execute["rl_s2"]
)
self.assertEqual(res["rp_s1"], self.expected_entries[to_execute["rl_s1"]])
self.assertEqual(res["rp_s2"], self.expected_entries[to_execute["rl_s2"]])

self.expected_entries[to_execute["rl"]] = to_execute["rp"]

def test_single(self):
self.rand = Random(0)
self.test_steps = 2000
self.gen_params = GenParams(test_core_config.replace(phys_regs_bits=5, rob_entries_bits=6))
m = SimpleTestCircuit(FRAT(gen_params=self.gen_params))
self.m = m

self.log_regs = self.gen_params.isa.reg_cnt
self.phys_regs = 2**self.gen_params.phys_regs_bits

self.to_execute_list = deque()
self.expected_entries = [0 for _ in range(self.log_regs)]

self.gen_input()
with self.run_simulation(m) as sim:
sim.add_sync_process(self.do_rename)


class TestRetirementRegisterAliasTable(TestCaseWithSimulator):
def gen_input(self):
for _ in range(self.test_steps):
rl = self.rand.randrange(self.gen_params.isa.reg_cnt)
rp = self.rand.randrange(1, 2**self.gen_params.phys_regs_bits) if rl != 0 else 0
side_fx = self.rand.randrange(0, 2)

self.to_execute_list.append({"rl": rl, "rp": rp, "side_fx": side_fx})

def do_commit(self):
for _ in range(self.test_steps):
to_execute = self.to_execute_list.pop()
res = yield from self.m.commit.call(
rl_dst=to_execute["rl"], rp_dst=to_execute["rp"], side_fx=to_execute["side_fx"]
)
self.assertEqual(res["old_rp_dst"], self.expected_entries[to_execute["rl"]])

if to_execute["side_fx"]:
self.expected_entries[to_execute["rl"]] = to_execute["rp"]

def test_single(self):
self.rand = Random(0)
self.test_steps = 2000
self.gen_params = GenParams(test_core_config.replace(phys_regs_bits=5, rob_entries_bits=6))
m = SimpleTestCircuit(RRAT(gen_params=self.gen_params))
self.m = m

self.log_regs = self.gen_params.isa.reg_cnt
self.phys_regs = 2**self.gen_params.phys_regs_bits

self.to_execute_list = deque()
self.expected_entries = [0 for _ in range(self.log_regs)]

self.gen_input()
with self.run_simulation(m) as sim:
sim.add_sync_process(self.do_commit)

0 comments on commit e4202c9

Please sign in to comment.