English subtitles

← Packet Recreation cs348 unit4

Get Embed Code
1 Language

Showing Revision 1 created 03/06/2013 by Cogi-Admin.

  1. We have just implemented our watch interface method. And that method will emit
  2. an event when the packet was detected. And while it is doing that, it also
  3. stores the data it sees in a list of bytes. Now, your job is to use that list of
  4. bytes and recreate a packet from it, right? We have a list of bytes, it's just
  5. in a serial order. Now, we have to associate the values in this list to the
  6. fields of our packet, so we can use it in our testbench for coverage collection
  7. and checking and all that good stuff. If you remember, our header, packet header
  8. had 2 subfields. An address field that was bits 0 and 1 and the length field is
  9. basically from 7 to 2. So, when you have the index into the list of byte, here's
  10. how it works. You give the listing. You give the index, so which byte you want
  11. to see. And if you want to subselect a range of bits, you use a second pair of
  12. brackets and then give that range of bits. So, here's an example. If I have a
  13. list of bytes, it would be called my_list. I could say, I want list element
  14. number 4 and I want only pull out the bits from 5 to 3. If you look in this
  15. method, here, we already give you some scaffolding. We're handing in the list of
  16. bytes, so it's called like that. And then, we're returning our packet_s type.
  17. Here you can with documentation associate the right fields. So here, we start
  18. with the address, we going to index the list of bytes. And now, you have to
  19. basically put the right values into the address field, the length field, the
  20. payload, and the parent.