[AVM]跨层次连接

上一篇 / 下一篇  2008-06-12 17:05:57

[AVM]跨层次连接
对于port-to-port连接(如上图中的C), 连接方向如下:
subcomponent.port.connect(port)
 
对于export-to-export连接(如上图中的E), 连接方向如下:
export.connect(subcomponent.export)
 
由上可以看出, 连接的方向是: 从producer到comsumer,  从左到右
 
代码如下 :

  1. Producer
  2. 1 class producer extends avm_named_component;
    2
    3     avm_blocking_put_port #(transaction) put_port;
    4     
    5     gen g;
    6     conv c;
    7     tlm_fifo #(transaction) f;
    8     
    9     function new(string name, avm_named_component parent);
    10     super.new(name, parent);
    11     put_port = new(“put_port”, this);
    12     g = new(“gen”, this);
    13     c = new(“conv”, this);
    14     f = new(“fifo”, this);
    15     endfunction
    16     
    17     function void connect();
    18     g.put_port.connect(f.blocking_put_export); // A
    19     c.get_port.connect(f.blocking_get_export); // B
    20     endfunction
    21     
    22     function void import_connections();
    23     c.put_port.connect(put_port); // C
    24     endfunction
    25
    26 endclass
     
  3. Comsumer
  4. 1 class consumer extends avm_named_component;
    2
    3     avm_blocking_put_export #(transaction) put_export;
    4
    5     bfm b;
    6     tlm_fifo #(transaction) f;
    7     
    8     function new(string name, avm_named_component parent);
    9         super.new(name, parent);
    10         put_export = new(“put_export”, this);
    11         f = new(“fifo”, this);
    12         b = new(“bfm”, this);
    13     endfunction
    14     
    15     function void export_connections();
    16         put_export.connect(f.blocking_put_export); // E
    17     endfunction
    18     
    19     function void connect();
    20         b.get_port.connect(f.blocking_get_export); // F
    21     endfunction
    22
    23 endclass

TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

日历

« 2009-01-07  
    123
45678910
11121314151617
18192021222324
25262728293031

我的存档

数据统计

  • 访问量: 152
  • 日志数: 9
  • 建立时间: 2008-06-12
  • 更新时间: 2008-06-12

RSS订阅

Open Toolbar