WIP: completed stages of next-pc logic, still need to combine them into a pipeline
This commit is contained in:
parent
033d5d4f34
commit
231f5e72ec
8 changed files with 1708 additions and 587 deletions
|
|
@ -17,3 +17,4 @@ version.workspace = true
|
|||
[dependencies]
|
||||
fayalite.workspace = true
|
||||
serde.workspace = true
|
||||
simple-mermaid.workspace = true
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
25
crates/cpu/src/next_pc/next_pc.mermaid
Normal file
25
crates/cpu/src/next_pc/next_pc.mermaid
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
stateDiagram-v2
|
||||
direction LR
|
||||
|
||||
state "Next PC" as next_pc
|
||||
[*] --> next_pc
|
||||
|
||||
state "Fetch/Decode" as fetch_decode
|
||||
next_pc --> fetch_decode
|
||||
|
||||
state "Branch Predictor" as br_pred
|
||||
next_pc --> br_pred
|
||||
br_pred --> next_pc: cancel following
|
||||
|
||||
state "Post-decode" as post_decode
|
||||
fetch_decode --> post_decode
|
||||
br_pred --> post_decode
|
||||
post_decode --> next_pc: cancel following
|
||||
|
||||
state "Rename\nDispatch\nExecute" as execute
|
||||
post_decode --> execute
|
||||
|
||||
state "Retire" as retire
|
||||
execute --> retire
|
||||
retire --> [*]
|
||||
retire --> next_pc: cancel following
|
||||
|
|
@ -578,7 +578,8 @@ pub fn reg_alloc(config: &CpuConfig) {
|
|||
connect(unit_to_reg_alloc.unit_forwarding_info, unit_forwarding_info);
|
||||
connect(
|
||||
unit_forwarding_info.unit_output_writes[unit_index],
|
||||
unit_forwarding_info.ty()
|
||||
unit_forwarding_info
|
||||
.ty()
|
||||
.unit_output_writes
|
||||
.element()
|
||||
.HdlNone(),
|
||||
|
|
|
|||
|
|
@ -272,10 +272,7 @@ pub fn alu_branch(config: &CpuConfig, unit_index: usize) {
|
|||
connect(unit_to_reg_alloc, unit_base.unit_to_reg_alloc);
|
||||
connect(unit_base.cd, cd);
|
||||
connect(unit_base.execute_start.ready, true);
|
||||
connect(
|
||||
unit_base.execute_end,
|
||||
unit_base.execute_end.ty().HdlNone(),
|
||||
);
|
||||
connect(unit_base.execute_end, unit_base.execute_end.ty().HdlNone());
|
||||
#[hdl]
|
||||
if let HdlSome(execute_start) = ReadyValid::firing_data(unit_base.execute_start) {
|
||||
#[hdl]
|
||||
|
|
|
|||
|
|
@ -34,6 +34,18 @@ impl<T: Type, N: Size> ArrayVec<T, N> {
|
|||
len: 0u8.cast_to(self.len),
|
||||
}
|
||||
}
|
||||
#[hdl]
|
||||
pub fn new_full_sim(
|
||||
self,
|
||||
elements: impl ToSimValueWithType<ArrayType<T, N>>,
|
||||
) -> SimValue<Self> {
|
||||
let elements = elements.to_sim_value_with_type(self.elements);
|
||||
#[hdl(sim)]
|
||||
Self {
|
||||
elements,
|
||||
len: self.elements.len().to_sim_value_with_type(self.len),
|
||||
}
|
||||
}
|
||||
pub fn element(self) -> T {
|
||||
self.elements.element()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue