Compare commits
8 commits
master
...
more-alu-b
| Author | SHA1 | Date | |
|---|---|---|---|
| a3898e8c13 | |||
| 42056ce6b5 | |||
| b25448a275 | |||
| 99c019431b | |||
| dd2fe36869 | |||
| 225ceb0dfa | |||
| 67abfa2f5d | |||
| 5558763718 |
6 changed files with 459516 additions and 9245 deletions
File diff suppressed because it is too large
Load diff
111560
crates/cpu/tests/expected/rename_execute_retire_fibonacci_real.vcd
generated
Normal file
111560
crates/cpu/tests/expected/rename_execute_retire_fibonacci_real.vcd
generated
Normal file
File diff suppressed because it is too large
Load diff
153405
crates/cpu/tests/expected/rename_execute_retire_head_n1_real.vcd
generated
Normal file
153405
crates/cpu/tests/expected/rename_execute_retire_head_n1_real.vcd
generated
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
156877
crates/cpu/tests/expected/rename_execute_retire_slow_loop_real.vcd
generated
Normal file
156877
crates/cpu/tests/expected/rename_execute_retire_slow_loop_real.vcd
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1642,7 +1642,7 @@ macro_rules! impl_funnel_shift {
|
||||||
}
|
}
|
||||||
fn funnel_shr(high: Self, low: Self, shift: u32) -> Self {
|
fn funnel_shr(high: Self, low: Self, shift: u32) -> Self {
|
||||||
if shift == 0 {
|
if shift == 0 {
|
||||||
high
|
low
|
||||||
} else {
|
} else {
|
||||||
(high << ($ty::BITS - shift)) | (low >> shift)
|
(high << ($ty::BITS - shift)) | (low >> shift)
|
||||||
}
|
}
|
||||||
|
|
@ -4270,6 +4270,43 @@ fn test_rename_execute_retire_fibonacci_combinatorial() {
|
||||||
assert!(sim.read_bool(sim.io().all_outputs_written));
|
assert!(sim.read_bool(sim.io().all_outputs_written));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[hdl]
|
||||||
|
#[test]
|
||||||
|
fn test_rename_execute_retire_fibonacci_real() {
|
||||||
|
let _n = SourceLocation::normalize_files_for_tests();
|
||||||
|
let mut config = CpuConfig::new(
|
||||||
|
vec![
|
||||||
|
UnitConfig::new(UnitKind::AluBranch),
|
||||||
|
UnitConfig::new(UnitKind::AluBranch),
|
||||||
|
UnitConfig::new(UnitKind::AluBranch),
|
||||||
|
UnitConfig::new(UnitKind::LoadStore),
|
||||||
|
UnitConfig::new(UnitKind::TransformedMove),
|
||||||
|
],
|
||||||
|
NonZeroUsize::new(20).unwrap(),
|
||||||
|
);
|
||||||
|
config.fetch_width = NonZeroUsize::new(3).unwrap();
|
||||||
|
let m = rename_execute_retire_test_harness::<FibonacciInsns>(
|
||||||
|
PhantomConst::new_sized(config),
|
||||||
|
AluBranchKind::Real,
|
||||||
|
);
|
||||||
|
let mut sim = Simulation::new(m);
|
||||||
|
let _checked_vcd_output = checked_vcd_output!(
|
||||||
|
&mut sim,
|
||||||
|
"tests/expected/rename_execute_retire_fibonacci_real.vcd",
|
||||||
|
);
|
||||||
|
sim.write_clock(sim.io().cd.clk, false);
|
||||||
|
sim.write_reset(sim.io().cd.rst, true);
|
||||||
|
for cycle in 0..200 {
|
||||||
|
sim.advance_time(SimDuration::from_nanos(500));
|
||||||
|
println!("clock tick: {cycle}");
|
||||||
|
sim.write_clock(sim.io().cd.clk, true);
|
||||||
|
sim.advance_time(SimDuration::from_nanos(500));
|
||||||
|
sim.write_clock(sim.io().cd.clk, false);
|
||||||
|
sim.write_reset(sim.io().cd.rst, false);
|
||||||
|
}
|
||||||
|
assert!(sim.read_bool(sim.io().all_outputs_written));
|
||||||
|
}
|
||||||
|
|
||||||
struct SlowLoopInsns;
|
struct SlowLoopInsns;
|
||||||
|
|
||||||
impl SlowLoopInsns {
|
impl SlowLoopInsns {
|
||||||
|
|
@ -4389,6 +4426,46 @@ fn test_rename_execute_retire_slow_loop() {
|
||||||
assert!(sim.read_bool(sim.io().started_any_l2_reg_file_ops));
|
assert!(sim.read_bool(sim.io().started_any_l2_reg_file_ops));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[hdl]
|
||||||
|
#[test]
|
||||||
|
fn test_rename_execute_retire_slow_loop_real() {
|
||||||
|
let _n = SourceLocation::normalize_files_for_tests();
|
||||||
|
let mut config = CpuConfig::new(
|
||||||
|
vec![
|
||||||
|
UnitConfig::new(UnitKind::AluBranch),
|
||||||
|
UnitConfig::new(UnitKind::AluBranch),
|
||||||
|
UnitConfig::new(UnitKind::AluBranch),
|
||||||
|
UnitConfig::new(UnitKind::AluBranch),
|
||||||
|
UnitConfig::new(UnitKind::LoadStore),
|
||||||
|
UnitConfig::new(UnitKind::TransformedMove),
|
||||||
|
],
|
||||||
|
NonZeroUsize::new(20).unwrap(),
|
||||||
|
);
|
||||||
|
config.fetch_width = NonZeroUsize::new(4).unwrap();
|
||||||
|
let m = rename_execute_retire_test_harness::<SlowLoopInsns>(
|
||||||
|
PhantomConst::new_sized(config),
|
||||||
|
AluBranchKind::Real,
|
||||||
|
);
|
||||||
|
let mut sim = Simulation::new(m);
|
||||||
|
let _checked_vcd_output = checked_vcd_output!(
|
||||||
|
&mut sim,
|
||||||
|
"tests/expected/rename_execute_retire_slow_loop_real.vcd",
|
||||||
|
);
|
||||||
|
sim.write_clock(sim.io().cd.clk, false);
|
||||||
|
sim.write_reset(sim.io().cd.rst, true);
|
||||||
|
for cycle in 0..350 {
|
||||||
|
sim.advance_time(SimDuration::from_nanos(500));
|
||||||
|
println!("clock tick: {cycle}");
|
||||||
|
sim.write_clock(sim.io().cd.clk, true);
|
||||||
|
sim.advance_time(SimDuration::from_nanos(500));
|
||||||
|
sim.write_clock(sim.io().cd.clk, false);
|
||||||
|
sim.write_reset(sim.io().cd.rst, false);
|
||||||
|
}
|
||||||
|
assert!(sim.read_bool(sim.io().all_outputs_written));
|
||||||
|
// make sure we're actually testing L2 reg file ops
|
||||||
|
assert!(sim.read_bool(sim.io().started_any_l2_reg_file_ops));
|
||||||
|
}
|
||||||
|
|
||||||
/// equivalent of Unix's `head -n1`
|
/// equivalent of Unix's `head -n1`
|
||||||
struct HeadN1Insns;
|
struct HeadN1Insns;
|
||||||
|
|
||||||
|
|
@ -4508,6 +4585,42 @@ fn test_rename_execute_retire_head_n1() {
|
||||||
assert!(sim.read_bool(sim.io().all_outputs_written));
|
assert!(sim.read_bool(sim.io().all_outputs_written));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[hdl]
|
||||||
|
#[test]
|
||||||
|
fn test_rename_execute_retire_head_n1_real() {
|
||||||
|
let _n = SourceLocation::normalize_files_for_tests();
|
||||||
|
let mut config = CpuConfig::new(
|
||||||
|
vec![
|
||||||
|
UnitConfig::new(UnitKind::AluBranch),
|
||||||
|
UnitConfig::new(UnitKind::AluBranch),
|
||||||
|
UnitConfig::new(UnitKind::LoadStore),
|
||||||
|
UnitConfig::new(UnitKind::TransformedMove),
|
||||||
|
],
|
||||||
|
NonZeroUsize::new(20).unwrap(),
|
||||||
|
);
|
||||||
|
config.fetch_width = NonZeroUsize::new(2).unwrap();
|
||||||
|
let m = rename_execute_retire_test_harness::<HeadN1Insns>(
|
||||||
|
PhantomConst::new_sized(config),
|
||||||
|
AluBranchKind::Real,
|
||||||
|
);
|
||||||
|
let mut sim = Simulation::new(m);
|
||||||
|
let _checked_vcd_output = checked_vcd_output!(
|
||||||
|
&mut sim,
|
||||||
|
"tests/expected/rename_execute_retire_head_n1_real.vcd",
|
||||||
|
);
|
||||||
|
sim.write_clock(sim.io().cd.clk, false);
|
||||||
|
sim.write_reset(sim.io().cd.rst, true);
|
||||||
|
for cycle in 0..300 {
|
||||||
|
sim.advance_time(SimDuration::from_nanos(500));
|
||||||
|
println!("clock tick: {cycle}");
|
||||||
|
sim.write_clock(sim.io().cd.clk, true);
|
||||||
|
sim.advance_time(SimDuration::from_nanos(500));
|
||||||
|
sim.write_clock(sim.io().cd.clk, false);
|
||||||
|
sim.write_reset(sim.io().cd.rst, false);
|
||||||
|
}
|
||||||
|
assert!(sim.read_bool(sim.io().all_outputs_written));
|
||||||
|
}
|
||||||
|
|
||||||
struct SaveRestoreGprsInsns;
|
struct SaveRestoreGprsInsns;
|
||||||
|
|
||||||
impl SaveRestoreGprsInsns {
|
impl SaveRestoreGprsInsns {
|
||||||
|
|
@ -4609,7 +4722,7 @@ fn test_rename_execute_retire_save_restore_gprs() {
|
||||||
|
|
||||||
#[hdl]
|
#[hdl]
|
||||||
#[test]
|
#[test]
|
||||||
fn test_rename_execute_retire_real_alu_branch() {
|
fn test_rename_execute_retire_save_restore_gprs_real() {
|
||||||
let _n = SourceLocation::normalize_files_for_tests();
|
let _n = SourceLocation::normalize_files_for_tests();
|
||||||
let mut config = CpuConfig::new(
|
let mut config = CpuConfig::new(
|
||||||
vec![
|
vec![
|
||||||
|
|
@ -4628,7 +4741,7 @@ fn test_rename_execute_retire_real_alu_branch() {
|
||||||
let mut sim = Simulation::new(m);
|
let mut sim = Simulation::new(m);
|
||||||
let _checked_vcd_output = checked_vcd_output!(
|
let _checked_vcd_output = checked_vcd_output!(
|
||||||
&mut sim,
|
&mut sim,
|
||||||
"tests/expected/rename_execute_retire_real_alu_branch.vcd",
|
"tests/expected/rename_execute_retire_save_restore_gprs_real.vcd",
|
||||||
);
|
);
|
||||||
sim.write_clock(sim.io().cd.clk, false);
|
sim.write_clock(sim.io().cd.clk, false);
|
||||||
sim.write_reset(sim.io().cd.rst, true);
|
sim.write_reset(sim.io().cd.rst, true);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue