WIP linking next_pc stages together
This commit is contained in:
parent
231f5e72ec
commit
cfd04469ce
4 changed files with 862 additions and 208 deletions
|
|
@ -35,6 +35,7 @@ pub struct CpuConfig {
|
||||||
pub out_reg_num_width: usize,
|
pub out_reg_num_width: usize,
|
||||||
pub fetch_width: NonZeroUsize,
|
pub fetch_width: NonZeroUsize,
|
||||||
pub max_branches_per_fetch: NonZeroUsize,
|
pub max_branches_per_fetch: NonZeroUsize,
|
||||||
|
pub max_fetches_in_flight: NonZeroUsize,
|
||||||
pub log2_fetch_width_in_bytes: u8,
|
pub log2_fetch_width_in_bytes: u8,
|
||||||
/// default value for [`UnitConfig::max_in_flight`]
|
/// default value for [`UnitConfig::max_in_flight`]
|
||||||
pub default_unit_max_in_flight: NonZeroUsize,
|
pub default_unit_max_in_flight: NonZeroUsize,
|
||||||
|
|
@ -55,6 +56,12 @@ impl CpuConfig {
|
||||||
};
|
};
|
||||||
v
|
v
|
||||||
};
|
};
|
||||||
|
pub const DEFAULT_MAX_FETCHES_IN_FLIGHT: NonZeroUsize = {
|
||||||
|
let Some(v) = NonZeroUsize::new(16) else {
|
||||||
|
unreachable!();
|
||||||
|
};
|
||||||
|
v
|
||||||
|
};
|
||||||
pub const DEFAULT_LOG2_FETCH_WIDTH_IN_BYTES: u8 = 3;
|
pub const DEFAULT_LOG2_FETCH_WIDTH_IN_BYTES: u8 = 3;
|
||||||
pub const DEFAULT_UNIT_MAX_IN_FLIGHT: NonZeroUsize = {
|
pub const DEFAULT_UNIT_MAX_IN_FLIGHT: NonZeroUsize = {
|
||||||
let Some(v) = NonZeroUsize::new(8) else {
|
let Some(v) = NonZeroUsize::new(8) else {
|
||||||
|
|
@ -68,6 +75,7 @@ impl CpuConfig {
|
||||||
out_reg_num_width: Self::DEFAULT_OUT_REG_NUM_WIDTH,
|
out_reg_num_width: Self::DEFAULT_OUT_REG_NUM_WIDTH,
|
||||||
fetch_width: Self::DEFAULT_FETCH_WIDTH,
|
fetch_width: Self::DEFAULT_FETCH_WIDTH,
|
||||||
max_branches_per_fetch: Self::DEFAULT_MAX_BRANCHES_PER_FETCH,
|
max_branches_per_fetch: Self::DEFAULT_MAX_BRANCHES_PER_FETCH,
|
||||||
|
max_fetches_in_flight: Self::DEFAULT_MAX_FETCHES_IN_FLIGHT,
|
||||||
log2_fetch_width_in_bytes: Self::DEFAULT_LOG2_FETCH_WIDTH_IN_BYTES,
|
log2_fetch_width_in_bytes: Self::DEFAULT_LOG2_FETCH_WIDTH_IN_BYTES,
|
||||||
default_unit_max_in_flight: Self::DEFAULT_UNIT_MAX_IN_FLIGHT,
|
default_unit_max_in_flight: Self::DEFAULT_UNIT_MAX_IN_FLIGHT,
|
||||||
rob_size,
|
rob_size,
|
||||||
|
|
@ -138,11 +146,20 @@ impl CpuConfig {
|
||||||
#[hdl(get(|c| c.fetch_width.get()))]
|
#[hdl(get(|c| c.fetch_width.get()))]
|
||||||
pub type CpuConfigFetchWidth<C: PhantomConstGet<CpuConfig>> = DynSize;
|
pub type CpuConfigFetchWidth<C: PhantomConstGet<CpuConfig>> = DynSize;
|
||||||
|
|
||||||
|
#[hdl(get(|c| c.fetch_width.get() * 2))]
|
||||||
|
pub type TwiceCpuConfigFetchWidth<C: PhantomConstGet<CpuConfig>> = DynSize;
|
||||||
|
|
||||||
#[hdl(get(|c| c.max_branches_per_fetch.get()))]
|
#[hdl(get(|c| c.max_branches_per_fetch.get()))]
|
||||||
pub type CpuConfigMaxBranchesPerFetch<C: PhantomConstGet<CpuConfig>> = DynSize;
|
pub type CpuConfigMaxBranchesPerFetch<C: PhantomConstGet<CpuConfig>> = DynSize;
|
||||||
|
|
||||||
|
#[hdl(get(|c| c.max_fetches_in_flight.get()))]
|
||||||
|
pub type CpuConfigMaxFetchesInFlight<C: PhantomConstGet<CpuConfig>> = DynSize;
|
||||||
|
|
||||||
#[hdl(get(|c| c.log2_fetch_width_in_bytes.into()))]
|
#[hdl(get(|c| c.log2_fetch_width_in_bytes.into()))]
|
||||||
pub type CpuConfigLog2FetchWidthInBytes<C: PhantomConstGet<CpuConfig>> = DynSize;
|
pub type CpuConfigLog2FetchWidthInBytes<C: PhantomConstGet<CpuConfig>> = DynSize;
|
||||||
|
|
||||||
#[hdl(get(|c| c.fetch_width_in_bytes()))]
|
#[hdl(get(|c| c.fetch_width_in_bytes()))]
|
||||||
pub type CpuConfigFetchWidthInBytes<C: PhantomConstGet<CpuConfig>> = DynSize;
|
pub type CpuConfigFetchWidthInBytes<C: PhantomConstGet<CpuConfig>> = DynSize;
|
||||||
|
|
||||||
|
#[hdl(get(|c| c.rob_size.get()))]
|
||||||
|
pub type CpuConfigRobSize<C: PhantomConstGet<CpuConfig>> = DynSize;
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -16,10 +16,7 @@ stateDiagram-v2
|
||||||
br_pred --> post_decode
|
br_pred --> post_decode
|
||||||
post_decode --> next_pc: cancel following
|
post_decode --> next_pc: cancel following
|
||||||
|
|
||||||
state "Rename\nDispatch\nExecute" as execute
|
state "Execute/Retire" as execute_retire
|
||||||
post_decode --> execute
|
post_decode --> execute_retire
|
||||||
|
execute_retire --> [*]
|
||||||
state "Retire" as retire
|
execute_retire --> next_pc: cancel following
|
||||||
execute --> retire
|
|
||||||
retire --> [*]
|
|
||||||
retire --> next_pc: cancel following
|
|
||||||
|
|
@ -165,6 +165,9 @@ impl<T: Type, N: Size> ArrayVec<T, N> {
|
||||||
Err(value)
|
Err(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pub fn truncate_sim(this: &mut SimValue<Self>, len: usize) {
|
||||||
|
*this.len = len.min(*this.len);
|
||||||
|
}
|
||||||
pub fn mapped_ty<U: Type>(self, new_element_ty: U) -> ArrayVec<U, N> {
|
pub fn mapped_ty<U: Type>(self, new_element_ty: U) -> ArrayVec<U, N> {
|
||||||
ArrayVec {
|
ArrayVec {
|
||||||
elements: ArrayType[new_element_ty][N::from_usize(self.elements.len())],
|
elements: ArrayType[new_element_ty][N::from_usize(self.elements.len())],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue