English subtitles

← Refactoring the router environment part I cs348 unit7

Get Embed Code
1 Language


Showing Revision 1 created 04/13/2013 by Cogi-Admin.

  1. In the exercises of this lesson, we will refactor the code of the router
  2. environment to align it with the reuse methodologies. First, let's have a look
  3. at the components we currently have. In the router environment, we have an
  4. input_driver and a list of output_receivers, as well as the signal_map. We also
  5. have an input_monitor and a list of output_monitors which are connected to the
  6. data_checker. We will reorganize our codes to focus on agents around
  7. interfaces. We've already started working on the pkt_agent by splitting the
  8. input_driver into a pkt_sequencer and the pkt_driver. All we now need to do is
  9. add a monitor and then our agent is complete. We will modify the input monitor
  10. slightly and make it a packet monitor and then we're done. We've got an agent,
  11. where we can control a packet interface. We will also add a field to enable us
  12. to control whether the agent is active or passive. Another thing we need to
  13. consider is that the components on the input side do slightly different work to
  14. the components on the output side. So, if we're thinking about a packet
  15. interface, we basically have an INGRESS packet interface which enables us to
  16. drive packets into the router. And we also have an EGRESS kind of interface
  17. which works on the output of the router. Both of those are very similar, so we
  18. can basically use one agent, but we need to tell it whether it's an agent on
  19. the input side or on the output side. So, our pkt_agent will also have a
  20. direction field to notify whether it's an INGRESS or an EGRESS agent. For the
  21. INGRESS, we use it as shown here, on the EGRESS side, the pkt_agent is slightly
  22. different. Here, we don't need a sequencer because we only have the random
  23. delay, which we can control with a simple constraint. So, we will use the
  24. pkt_receiver as the driver and the pkt_monitor. And that is all the components
  25. we need for the EGRESS agent.