Skip to content

Commit

Permalink
More field refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
tilk committed Nov 6, 2023
1 parent cd4aa6a commit 120c4c8
Showing 1 changed file with 32 additions and 13 deletions.
45 changes: 32 additions & 13 deletions coreblocks/params/layouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,36 @@ def __init__(self, gen_params: GenParams):
self.regs_p = ("regs_p", [self.rp_s1, self.rp_s2, self.rp_dst])
"""Physical register numbers. They index the register file."""

self.reg_id = ("reg_id", gen_params.phys_regs_bits)
"""Physical register ID."""


class SchedulerLayouts:
"""Layouts used in the scheduler."""

def __init__(self, gen_params: GenParams):
fields = gen_params.get(CommonLayoutFields)

self.rs_selected = ("rs_selected", gen_params.rs_number_bits)
"""Reservation Station number for the instruction."""

self.rs_entry_id = ("rs_entry_id", gen_params.max_rs_entries_bits)
"""Reservation station entry ID for the instruction."""

self.regs_p_alloc_out = ("regs_p", [fields.rp_dst])
"""Physical register number for the destination operand, after allocation."""

self.regs_l_rob_in = (
(
"regs_l",
[
fields.rl_dst,
("rl_dst_v", 1),
],
),
)
"""Logical register number for the destination operand, before ROB allocation."""

self.reg_alloc_in = [
fields.exec_fn,
fields.regs_l,
Expand All @@ -106,21 +129,15 @@ def __init__(self, gen_params: GenParams):
self.reg_alloc_out = self.renaming_in = [
fields.exec_fn,
fields.regs_l,
("regs_p", [fields.rp_dst]),
self.regs_p_alloc_out,
fields.imm,
fields.csr,
fields.pc,
]

self.renaming_out = self.rob_allocate_in = [
fields.exec_fn,
(
"regs_l",
[
fields.rl_dst,
("rl_dst_v", 1),
],
),
self.regs_l_rob_in,
fields.regs_p,
fields.imm,
fields.csr,
Expand All @@ -140,23 +157,25 @@ def __init__(self, gen_params: GenParams):
fields.exec_fn,
fields.regs_p,
fields.rob_id,
("rs_selected", gen_params.rs_number_bits),
("rs_entry_id", gen_params.max_rs_entries_bits),
self.rs_selected,
self.rs_entry_id,
fields.imm,
fields.csr,
fields.pc,
]

self.free_rf_layout = [("reg_id", gen_params.phys_regs_bits)]
self.free_rf_layout = [fields.reg_id]


class RFLayouts:
"""Layouts used in the register file."""

def __init__(self, gen_params: GenParams):
self.rf_read_in = self.rf_free = [("reg_id", gen_params.phys_regs_bits)]
fields = gen_params.get(CommonLayoutFields)

self.rf_read_in = self.rf_free = [fields.reg_id]
self.rf_read_out = [("reg_val", gen_params.isa.xlen), ("valid", 1)]
self.rf_write = [("reg_id", gen_params.phys_regs_bits), ("reg_val", gen_params.isa.xlen)]
self.rf_write = [fields.reg_id, ("reg_val", gen_params.isa.xlen)]


class RATLayouts:
Expand Down

0 comments on commit 120c4c8

Please sign in to comment.