English subtitles

← What does this macro do cs348 unit7

Get Embed Code
1 Language

Download

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

  1. Here are the correct answers. First, the macro is a struct member. So you can
  2. see that up here in the name tag. So it can only be used in a struct, it's not
  3. an action which could be used inside a method. Then, you can see it
  4. instantiates a port. So here we have a port name, colon, direction, simple_port
  5. of this instance. So it instantiates a simple_port, it doesn't define the
  6. simple_port. And finally down here, you can see it sets the hdl_path, of that
  7. very port. So this is a fairly straightforward macro which only saves you a
  8. little bit of typing but nothing too exciting. So here I'm actually using this
  9. macro to define two ports. I have a clock, an input of type bit, and the path
  10. is clock. And data is a uint of bits 8. And the hdl path is data_op. There is a
  11. trace capability with macros which you can switch on. When you load code, it
  12. shows you what macros have successfully evaluated. So here you can see we had
  13. s_port data in uint bits 8, and so on and so forth has been reparsed as this
  14. string. So this is exactly the macro replacement with the actual values. And
  15. when you generate the environment, you can see in m1, we now have the data port
  16. simple_port of uint bits 8. And it has the hdl_path we specified.