Trait caminos_lib::router::Router [−][src]
pub trait Router: Eventful + Quantifiable {
fn insert(&mut self, phit: Rc<Phit>, port: usize, rng: &RefCell<StdRng>);
fn acknowledge(&mut self, port: usize, ack_message: AcknowledgeMessage);
fn num_virtual_channels(&self) -> usize;
fn virtual_port_size(&self, port: usize, virtual_channel: usize) -> usize;
fn iter_phits(&self) -> Box<dyn Iterator<Item = Rc<Phit>>>;
fn get_status_at_emisor(&self, port: usize) -> Option<&dyn StatusAtEmissor>;
fn get_maximum_credits_towards(
&self,
port: usize,
virtual_channel: usize
) -> Option<usize>;
fn get_index(&self) -> Option<usize>;
fn aggregate_statistics(
&self,
statistics: Option<ConfigurationValue>,
router_index: usize,
total_routers: usize,
cycle: usize
) -> Option<ConfigurationValue>;
fn reset_statistics(&mut self, next_cycle: usize);
}
Expand description
The interface that a router type must follow.
Required methods
Introduces a phit into the router in the specified port
fn acknowledge(&mut self, port: usize, ack_message: AcknowledgeMessage)
fn acknowledge(&mut self, port: usize, ack_message: AcknowledgeMessage)
Receive the acknowledge of a phit clear. Generally to increase the credit count
fn num_virtual_channels(&self) -> usize
fn num_virtual_channels(&self) -> usize
To get the number of virtual channels the router uses.
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.
To iterate over the phits managed by the router. Required to account memory.
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.
Get the maximum number of credits towards the neighbour. To be used in policies such as VirtualChannelPolicy::LowestSinghWeight.
Get the index of the router in the topology. To be used in policies such as VirtualChannelPolicy::LowestSinghWeight.
fn aggregate_statistics(
&self,
statistics: Option<ConfigurationValue>,
router_index: usize,
total_routers: usize,
cycle: usize
) -> Option<ConfigurationValue>
fn aggregate_statistics(
&self,
statistics: Option<ConfigurationValue>,
router_index: usize,
total_routers: usize,
cycle: usize
) -> 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.
fn reset_statistics(&mut self, next_cycle: usize)
fn reset_statistics(&mut self, next_cycle: usize)
Clears all collected statistics