working on reg_alloc -- wire up free_regs_tracker.alloc_out
All checks were successful
/ deps (push) Successful in 15s
/ test (push) Successful in 25m37s

This commit is contained in:
Jacob Lifshay 2025-01-15 19:47:00 -08:00
parent 9781f1f4c5
commit 88eff5952b
Signed by: programmerjake
SSH key fingerprint: SHA256:HnFTLGpSm4Q4Fj502oCFisjZSoakwEuTsJJMSke63RQ
4 changed files with 2274 additions and 1866 deletions

View file

@ -155,9 +155,20 @@ pub fn reg_alloc(config: &CpuConfig) {
unit_free_regs_tracker.free_in[0].data,
HdlOption[UInt[config.out_reg_num_width]].uninit(), // FIXME: just for debugging
);
connect(
unit_free_regs_tracker.alloc_out[0].ready,
Bool.uninit(), // FIXME: just for debugging
);
connect(unit_free_regs_tracker.alloc_out[0].ready, false);
for fetch_index in 0..config.fetch_width.get() {
#[hdl]
if let HdlNone = unit_free_regs_tracker.alloc_out[0].data {
// must come after to override connects in loops above
connect(available_units[fetch_index][unit_index], false);
}
#[hdl]
if let HdlSome(unit_num) = selected_unit_nums[fetch_index] {
#[hdl]
if unit_num.value.cmp_eq(unit_index) {
connect(unit_free_regs_tracker.alloc_out[0].ready, true);
}
}
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -683,7 +683,7 @@ b0 i"
1j"
sHdlSome\x20(1) k"
b0 l"
0m"
1m"
0n"
0o"
0p"
@ -747,7 +747,7 @@ b0 K#
0L#
1M#
b0 N#
sHdlNone\x20(0) O#
sHdlSome\x20(1) O#
b0 P#
0Q#
1R#
@ -756,7 +756,7 @@ b0 T#
1U#
sHdlSome\x20(1) V#
b0 W#
0X#
1X#
$end
#500000
1!
@ -780,7 +780,20 @@ $end
1b"
1d"
1f"
1n"
1Q#
b1 l"
1"#
0##
1$#
1(#
b1 *#
14#
b1 6#
1L#
b1 N#
b1 P#
b1 W#
#2000000
0!
0b"
@ -792,7 +805,18 @@ $end
1b"
1d"
1f"
1o"
1Q#
b10 l"
0"#
0(#
b10 *#
04#
b10 6#
0L#
b10 N#
b10 P#
b10 W#
#3000000
0!
0b"
@ -804,7 +828,21 @@ $end
1b"
1d"
1f"
1p"
1Q#
b11 l"
1%#
0&#
1'#
1(#
0)#
b11 *#
14#
b11 6#
1L#
b11 N#
b11 P#
b11 W#
#4000000
0!
0b"
@ -816,7 +854,17 @@ $end
1b"
1d"
1f"
1q"
1Q#
b100 l"
0%#
0(#
04#
b100 6#
0L#
b100 N#
b100 P#
b100 W#
#5000000
0!
0b"
@ -828,7 +876,20 @@ $end
1b"
1d"
1f"
1r"
1Q#
b101 l"
1+#
0,#
1-#
11#
b1 3#
14#
b101 6#
1L#
b101 N#
b101 P#
b101 W#
#6000000
0!
0b"
@ -840,7 +901,18 @@ $end
1b"
1d"
1f"
1s"
1Q#
b110 l"
0+#
01#
b10 3#
04#
b110 6#
0L#
b110 N#
b110 P#
b110 W#
#7000000
0!
0b"
@ -852,7 +924,22 @@ $end
1b"
1d"
1f"
1t"
1Q#
b111 l"
1.#
0/#
10#
11#
02#
b11 3#
14#
05#
b111 6#
1L#
b111 N#
b111 P#
b111 W#
#8000000
0!
0b"
@ -864,7 +951,16 @@ $end
1b"
1d"
1f"
1u"
1Q#
b1000 l"
0.#
01#
04#
0L#
b1000 N#
b1000 P#
b1000 W#
#9000000
0!
0b"
@ -876,5 +972,229 @@ $end
1b"
1d"
1f"
1v"
1Q#
b1001 l"
17#
08#
19#
1=#
b1 ?#
1I#
b1 K#
1L#
b1001 N#
b1001 P#
b1001 W#
#10000000
0!
0b"
0d"
0f"
0Q#
#10500000
1!
1b"
1d"
1f"
1w"
1Q#
b1010 l"
07#
0=#
b10 ?#
0I#
b10 K#
0L#
b1010 N#
b1010 P#
b1010 W#
#11000000
0!
0b"
0d"
0f"
0Q#
#11500000
1!
1b"
1d"
1f"
1x"
1Q#
b1011 l"
1:#
0;#
1<#
1=#
0>#
b11 ?#
1I#
b11 K#
1L#
b1011 N#
b1011 P#
b1011 W#
#12000000
0!
0b"
0d"
0f"
0Q#
#12500000
1!
1b"
1d"
1f"
1y"
1Q#
b1100 l"
0:#
0=#
0I#
b100 K#
0L#
b1100 N#
b1100 P#
b1100 W#
#13000000
0!
0b"
0d"
0f"
0Q#
#13500000
1!
1b"
1d"
1f"
1z"
1Q#
b1101 l"
1@#
0A#
1B#
1F#
b1 H#
1I#
b101 K#
1L#
b1101 N#
b1101 P#
b1101 W#
#14000000
0!
0b"
0d"
0f"
0Q#
#14500000
1!
1b"
1d"
1f"
1{"
1Q#
b1110 l"
0@#
0F#
b10 H#
0I#
b110 K#
0L#
b1110 N#
b1110 P#
b1110 W#
#15000000
0!
0b"
0d"
0f"
0Q#
#15500000
1!
1b"
1d"
1f"
1|"
1Q#
b1111 l"
1C#
0D#
1E#
1F#
0G#
b11 H#
1I#
0J#
b111 K#
1L#
0M#
b1111 N#
b1111 P#
b1111 W#
#16000000
0!
0b"
0d"
0f"
0Q#
#16500000
1!
1b"
1d"
1f"
1}"
1Q#
0R"
sHdlNone\x20(0) T"
sHdlNone\x20(0) Z"
sHdlNone\x20(0) k"
b0 l"
0m"
0C#
0F#
0I#
0L#
sHdlNone\x20(0) O#
b0 P#
sHdlNone\x20(0) V#
b0 W#
0X#
#17000000
0!
0b"
0d"
0f"
0Q#
#17500000
1!
1b"
1d"
1f"
1Q#
#18000000
0!
0b"
0d"
0f"
0Q#
#18500000
1!
1b"
1d"
1f"
1Q#
#19000000
0!
0b"
0d"
0f"
0Q#
#19500000
1!
1b"
1d"
1f"
1Q#
#20000000

View file

@ -88,7 +88,7 @@ fn test_reg_alloc() {
},
),
);
for cycle in 0..10 {
for cycle in 0..20 {
sim.advance_time(SimDuration::from_nanos(500));
sim.write_clock(sim.io().cd.clk, true);
sim.advance_time(SimDuration::from_nanos(500));
@ -225,9 +225,29 @@ circuit reg_alloc:
wire _uninit_expr: Ty24
invalidate _uninit_expr
connect unit_0_free_regs_tracker.free_in[0].data, _uninit_expr @[reg_alloc.rs 154:9]
wire _uninit_expr_1: UInt<1>
invalidate _uninit_expr_1
connect unit_0_free_regs_tracker.alloc_out[0].ready, _uninit_expr_1 @[reg_alloc.rs 158:9]
connect unit_0_free_regs_tracker.alloc_out[0].ready, UInt<1>(0h0) @[reg_alloc.rs 158:9]
match unit_0_free_regs_tracker.alloc_out[0].data: @[reg_alloc.rs 161:13]
HdlNone:
connect available_units[0][0], UInt<1>(0h0) @[reg_alloc.rs 163:17]
HdlSome(_match_arm_value_9):
skip
match selected_unit_nums[0]: @[reg_alloc.rs 166:13]
HdlNone:
skip
HdlSome(_match_arm_value_10):
when eq(_match_arm_value_10.value, UInt<64>(0h0)): @[reg_alloc.rs 168:17]
connect unit_0_free_regs_tracker.alloc_out[0].ready, UInt<1>(0h1) @[reg_alloc.rs 169:21]
match unit_0_free_regs_tracker.alloc_out[0].data: @[reg_alloc.rs 161:13]
HdlNone:
connect available_units[1][0], UInt<1>(0h0) @[reg_alloc.rs 163:17]
HdlSome(_match_arm_value_11):
skip
match selected_unit_nums[1]: @[reg_alloc.rs 166:13]
HdlNone:
skip
HdlSome(_match_arm_value_12):
when eq(_match_arm_value_12.value, UInt<64>(0h0)): @[reg_alloc.rs 168:17]
connect unit_0_free_regs_tracker.alloc_out[0].ready, UInt<1>(0h1) @[reg_alloc.rs 169:21]
module alu_branch: @[alu_branch.rs 15:1]
input cd: Ty0 @[alu_branch.rs 18:29]
module unit_free_regs_tracker: @[unit_free_regs_tracker.rs 7:1]