pub struct Basic { /* private fields */ }
Expand description
The basic Router struct. Very similar to FSIN’s router.
Implementations§
Trait Implementations§
Source§impl Eventful for Basic
impl Eventful for Basic
Source§fn process(
&mut self,
simulation: &SimulationShared,
mutable: &mut SimulationMut,
) -> Vec<EventGeneration>
fn process( &mut self, simulation: &SimulationShared, mutable: &mut SimulationMut, ) -> Vec<EventGeneration>
main routine of the router. Do all things that must be done in a cycle, if any.
Source§fn as_eventful(&self) -> Weak<RefCell<dyn Eventful>>
fn as_eventful(&self) -> Weak<RefCell<dyn Eventful>>
Extract the eventful from the implementing class. Required since
as Rc<RefCell<Eventful>>
does not work.Source§fn schedule(
&mut self,
current_cycle: Time,
delay: Time,
) -> Option<EventGeneration>
fn schedule( &mut self, current_cycle: Time, delay: Time, ) -> Option<EventGeneration>
Schedule this component to be executed after
delay
cycles as soon as possible.
This should include waits to synchronize with the component’s internal clock.
Call with 0 to schedule as soon as possible, including the current cycle.
Call with 1 to schedule in a future cycle as soon as possible.
Returns None if the component decides against to be scheduled. For example due to already being scheduled.Source§impl Quantifiable for Basic
impl Quantifiable for Basic
Source§fn total_memory(&self) -> usize
fn total_memory(&self) -> usize
Get the total memory currently being employed by the implementing type. Both stack and heap.
Source§fn print_memory_breakdown(&self)
fn print_memory_breakdown(&self)
Prints by stdout how much memory is used per component.
Source§fn forecast_total_memory(&self) -> usize
fn forecast_total_memory(&self) -> usize
Get an estimation on how much memory the type could reach during the simulation.
Source§impl Router for Basic
impl Router for Basic
Source§fn insert(
&mut self,
current_cycle: Time,
phit: Rc<Phit>,
port: usize,
rng: &mut StdRng,
) -> Vec<EventGeneration>
fn insert( &mut self, current_cycle: Time, phit: Rc<Phit>, port: usize, rng: &mut StdRng, ) -> Vec<EventGeneration>
Introduces a phit into the router in the specified port.
Should return a list of events to push into the event queue. This may include to schedule itself or a subcomponent.
Source§fn acknowledge(
&mut self,
current_cycle: Time,
port: usize,
ack_message: AcknowledgeMessage,
) -> Vec<EventGeneration>
fn acknowledge( &mut self, current_cycle: Time, port: usize, ack_message: AcknowledgeMessage, ) -> Vec<EventGeneration>
Receive the acknowledge of a phit clear. Generally to increase the credit count.
Should return a list of events to push into the event queue. This may include to schedule itself or a subcomponent.
Source§fn num_virtual_channels(&self) -> usize
fn num_virtual_channels(&self) -> usize
To get the number of virtual channels the router uses.
Source§fn virtual_port_size(&self, _port: usize, _virtual_channel: usize) -> usize
fn virtual_port_size(&self, _port: usize, _virtual_channel: usize) -> usize
Get the number of phits that fit inside the buffer of a port.
Source§fn iter_phits(&self) -> Box<dyn Iterator<Item = Rc<Phit>>>
fn iter_phits(&self) -> Box<dyn Iterator<Item = Rc<Phit>>>
To iterate over the phits managed by the router. Required to account memory.
Source§fn get_status_at_emisor(&self, port: usize) -> Option<&dyn StatusAtEmissor>
fn get_status_at_emisor(&self, port: usize) -> Option<&dyn StatusAtEmissor>
Get a virtual port if any.
To be used in some policies, e.g., VirtualChannelPolicy::Shortest.
Source§fn get_maximum_credits_towards(
&self,
_port: usize,
_virtual_channel: usize,
) -> Option<usize>
fn get_maximum_credits_towards( &self, _port: usize, _virtual_channel: usize, ) -> Option<usize>
Get the maximum number of credits towards the neighbour.
To be used in policies such as VirtualChannelPolicy::LowestSinghWeight.
Source§fn get_index(&self) -> Option<usize>
fn get_index(&self) -> Option<usize>
Get the index of the router in the topology.
To be used in policies such as VirtualChannelPolicy::LowestSinghWeight.
Source§fn aggregate_statistics(
&self,
statistics: Option<ConfigurationValue>,
router_index: usize,
total_routers: usize,
cycle: Time,
) -> Option<ConfigurationValue>
fn aggregate_statistics( &self, statistics: Option<ConfigurationValue>, router_index: usize, total_routers: usize, cycle: Time, ) -> Option<ConfigurationValue>
To optionally write router statistics into the simulation output.
Each router receives the aggregate of the statistics of the previous routers.
In the frist router we have
statistics=None
and router_index=0
.
In the last router we have router_index+1==total_routers==topology.routers.len()
, that may be used for final normalizations.Source§fn reset_statistics(&mut self, next_cycle: Time)
fn reset_statistics(&mut self, next_cycle: Time)
Clears all collected statistics
Source§fn build_emissor_status(
&self,
port: usize,
topology: &dyn Topology,
) -> Box<dyn StatusAtEmissor + 'static>
fn build_emissor_status( &self, port: usize, topology: &dyn Topology, ) -> Box<dyn StatusAtEmissor + 'static>
Build a status for an element that sends packets directly to the router ports.
This is intended to build the status of the servers.
Auto Trait Implementations§
impl Freeze for Basic
impl !RefUnwindSafe for Basic
impl !Send for Basic
impl !Sync for Basic
impl Unpin for Basic
impl !UnwindSafe for Basic
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more