Class: ItegrationVerb

Inherits:
Object
  • Object
show all
Extended by:
ItegrationAttr
Defined in:
lib/tdl/exlib/itegration_verb.rb,
lib/tdl/exlib/itegration_verb.rb

Overview

动态删除 silence_ block

Direct Known Subclasses

ABlock, ClockManage

Constant Summary collapse

@@child =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ItegrationAttr

compact_link_itgt, has_attr, has_flag, itegration_explort, itegration_hash, itegration_link, link_explort, link_itgt, param

Constructor Details

#initialize(name_str = nil, pins_map = {}, top_module = nil) ⇒ ItegrationVerb

Returns a new instance of ItegrationVerb.



346
347
348
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/tdl/exlib/itegration_verb.rb', line 346

def initialize(name_str=nil,pins_map={},top_module=nil)
    @top_module = top_module
    if name_str.to_s.strip.empty?
        @nickname = ""
    else
        @nickname =  "#{name_str.to_s.strip}_"
    end
    @pins_map = pins_map
    _names_pool_inst()
    # @itgt_links = ItgtLinks.new(self)
    ## 为child module 生成方法
    init_children_modules()
    # init_children_modules_post()
end

Instance Attribute Details

#init_instObject

Returns the value of attribute init_inst.



274
275
276
# File 'lib/tdl/exlib/itegration_verb.rb', line 274

def init_inst
  @init_inst
end

#inst_indexObject

Returns the value of attribute inst_index.



275
276
277
# File 'lib/tdl/exlib/itegration_verb.rb', line 275

def inst_index
  @inst_index
end

#names_poolObject

Returns the value of attribute names_pool.



273
274
275
# File 'lib/tdl/exlib/itegration_verb.rb', line 273

def names_pool
  @names_pool
end

#nicknameObject

Returns the value of attribute nickname.



273
274
275
# File 'lib/tdl/exlib/itegration_verb.rb', line 273

def nickname
  @nickname
end

#pins_mapObject

Returns the value of attribute pins_map.



273
274
275
# File 'lib/tdl/exlib/itegration_verb.rb', line 273

def pins_map
  @pins_map
end

#top_moduleObject

Returns the value of attribute top_module.



272
273
274
# File 'lib/tdl/exlib/itegration_verb.rb', line 272

def top_module
  @top_module
end

Class Method Details

.constraints_block(&block) ⇒ Object

约束 block



887
888
889
890
891
# File 'lib/tdl/exlib/itegration_verb.rb', line 887

def self.constraints_block(&block)
    carray = self.record_instance_var_block("constraints_array",[])
    carray << block if block_given?
    self.set_instance_var("constraints_array",carray)
end

.curr_itgt_popObject



310
311
312
# File 'lib/tdl/exlib/itegration_verb.rb', line 310

def self.curr_itgt_pop
    $_implicit_curr_itgt_.pop
end

.curr_itgt_push(itgt) ⇒ Object



306
307
308
# File 'lib/tdl/exlib/itegration_verb.rb', line 306

def self.curr_itgt_push(itgt)
    $_implicit_curr_itgt_ << itgt
end

.def_test_unit(name, path, &block) ⇒ Object

添加测试用例



738
739
740
741
742
743
# File 'lib/tdl/exlib/itegration_verb.rb', line 738

def self.def_test_unit(name,path,&block)
    _inst_test_unit_blocks_ = instance_variable_get("@_inst_test_unit_blocks_")
    _inst_test_unit_blocks_ ||= []
    _inst_test_unit_blocks_ << [name.to_s, path, block]
    instance_variable_set("@_inst_test_unit_blocks_",_inst_test_unit_blocks_)
end

.flag_match(attr) ⇒ Object



320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
# File 'lib/tdl/exlib/itegration_verb.rb', line 320

def self.flag_match(attr)
    explort_flags = get_itgt_var('itegration_flag_collect')
    unless attr
        return true
    end

    if attr.empty?
        return true
    end

    unless explort_flags
        explort_flags = []
    end

    explort_flags = explort_flags.map{ |e| e.to_s }.sort
    attr = attr.map { |e| e.to_s }.sort

    if(explort_flags & attr) == attr
        return true
    else
        return false
    end
end

.get_instance_var(name) ⇒ Object



817
818
819
# File 'lib/tdl/exlib/itegration_verb.rb', line 817

def self.get_instance_var(name)
    _inst_ccc_ = instance_variable_get("@_#{name}_")
end

.has_module(dir, *names) ⇒ Object

生成 itgt内的模块,



746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
# File 'lib/tdl/exlib/itegration_verb.rb', line 746

def self.has_module(dir,*names)
    unless File.exist? dir
        Dir.mkdir dir
    end
    ## itgt 生成 sdl 模块
    names.each do |name|
        # unless container_hash[name.to_s]
        #     container_hash[name.to_s] = []
        # end
        self.define_singleton_method("#{name}_sdl_eval") do |&block|
            _sdl_eval_blocks_hash_ = instance_variable_get("@_sdl_eval_blocks_hash_")
            _sdl_eval_dir_hash_ = instance_variable_get("@_sdl_eval_dir_hash_")
            _sdl_eval_blocks_hash_ ||= {}
            _sdl_eval_dir_hash_ ||= {}

            if _sdl_eval_blocks_hash_[name]
                _sdl_eval_blocks_hash_[name] << block
                # _sdl_eval_blocks_hash_[name] << $_implicit_curr_itgt_.wrap_nont_itgt(&block)
                # _sdl_eval_blocks_hash_[name] << lambda {|itgt| block.call }
            else
                _sdl_eval_blocks_hash_[name] = [block]
                # _sdl_eval_blocks_hash_[name] = [$_implicit_curr_itgt_.wrap_nont_itgt(&block)]
                # _sdl_eval_blocks_hash_[name] == [ lambda {|itgt| block.call }]
            end

            _sdl_eval_dir_hash_[name] = dir if dir
            instance_variable_set("@_sdl_eval_dir_hash_",_sdl_eval_dir_hash_)
            instance_variable_set("@_sdl_eval_blocks_hash_",_sdl_eval_blocks_hash_)
        end
        ## 在 top_module 后再执行
        self.define_singleton_method("#{name}_sdl_post_eval") do |&block|
            $_implicit_curr_itgt_.with_none_itgt do 
                _blocks_hash_ = instance_variable_get("@_sdl_eval_blocks_post_hash_")
                _sdl_eval_dir_hash_ = instance_variable_get("@_sdl_eval_dir_hash_")
                _blocks_hash_ ||= {}
                _sdl_eval_dir_hash_ ||= {}

                if _blocks_hash_[name]
                    _blocks_hash_[name] << block    #$_implicit_curr_itgt_.wrap_nont_itgt(&block)
                else
                    _blocks_hash_[name] = [block]   #[$_implicit_curr_itgt_.wrap_nont_itgt(&block)]
                end

                _sdl_eval_dir_hash_[name] = dir if dir
                instance_variable_set("@_sdl_eval_dir_hash_",_sdl_eval_dir_hash_)
                instance_variable_set("@_sdl_eval_blocks_post_hash_",_blocks_hash_)
            end
        end
    end
end

.inherited(subclass) ⇒ Object



545
546
547
548
549
# File 'lib/tdl/exlib/itegration_verb.rb', line 545

def self.inherited(subclass)
    unless @@child.include? subclass
        @@child << subclass
    end
end

.record_instance_var_block(name, default = [], &block) ⇒ Object



797
798
799
800
801
802
803
804
805
806
807
808
# File 'lib/tdl/exlib/itegration_verb.rb', line 797

def self.record_instance_var_block(name,default=[],&block)
    _inst_ccc_ = instance_variable_get("@_#{name}_")
    _inst_ccc_ ||= default
    if _inst_ccc_.is_a? Array
        _inst_ccc_ << block if block_given?
    elsif _inst_ccc_.is_a? Hash
        _inst_ccc_[name.to_s] = block if block_given?
    else
        _inst_ccc_ = block
    end
    instance_variable_set("@_#{name}_",_inst_ccc_)
end

.set_instance_var(name, value) ⇒ Object



810
811
812
813
814
815
# File 'lib/tdl/exlib/itegration_verb.rb', line 810

def self.set_instance_var(name,value)
    _inst_ccc_ = instance_variable_get("@_#{name}_")
    # _inst_ccc_ ||= default
    _inst_ccc_ = value
    instance_variable_set("@_#{name}_",_inst_ccc_)
end

.techbench_block(name, default_tb_argvs_hash = {}) ⇒ Object

测试向量实现 作用于是 top_module



822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
# File 'lib/tdl/exlib/itegration_verb.rb', line 822

def self.techbench_block(name,default_tb_argvs_hash={})
    hash = self.record_instance_var_block("techbench_name_hash",{})
    ## args hash
    argvs_hash = self.get_instance_var("techbench_argvs_hash") || {}
    # self.set_instance_var("techbench_argvs_hash",{}) unless argvs_hash
    argvs_hash[name.to_s] = default_tb_argvs_hash
    set_instance_var("techbench_argvs_hash",argvs_hash)
    ##需要激活的block
    self.define_singleton_method("#{name}_tb_eval") do |&block|
        ## 把 block 塞到数组中
        hash[name.to_s] = self.record_instance_var_block("techbench_#{name}_blocks",[],&block)
        self.set_instance_var("techbench_name_hash",hash)
        hash[name.to_s]
    end

    ## 生成实例方法
    self.class_exec do

        define_method(:active_techbench_vector) do |name,tb_argvs_hash={}|
            hash = get_itgt_var("active_techbench_vector",{})
            _default_tb_argvs_hash = self.class.get_instance_var("techbench_argvs_hash")[name.to_s] || {}
            hash[name.to_s] = _default_tb_argvs_hash.merge(tb_argvs_hash)
            set_itgt_var('active_techbench_vector',hash)
        end
    end

end

.top_module_eval(&block) ⇒ Object



722
723
724
725
726
727
# File 'lib/tdl/exlib/itegration_verb.rb', line 722

def self.top_module_eval(&block)
    _inst_blocks_ = instance_variable_get("@_inst_blocks_")
    _inst_blocks_ ||= []
    _inst_blocks_ << block
    instance_variable_set("@_inst_blocks_",_inst_blocks_)
end

.top_module_techbench_eval(&block) ⇒ Object



729
730
731
732
733
734
# File 'lib/tdl/exlib/itegration_verb.rb', line 729

def self.top_module_techbench_eval(&block)
    _inst_tb_blocks_ = instance_variable_get("@_inst_tb_blocks_")
    _inst_tb_blocks_ ||= []
    _inst_tb_blocks_ << block
    instance_variable_set("@_inst_tb_blocks_",_inst_tb_blocks_)
end

.with_new_itgt(itgt, &block) ⇒ Object

关于 当前 itgt stack 操作



299
300
301
302
303
304
# File 'lib/tdl/exlib/itegration_verb.rb', line 299

def self.with_new_itgt(itgt,&block)
    $_implicit_curr_itgt_ << itgt
    rel = block.call
    $_implicit_curr_itgt_.pop
    return rel
end

Instance Method Details

#cal_inst_index(base = 0) ⇒ Object



283
284
285
286
287
288
289
290
291
292
293
294
295
296
# File 'lib/tdl/exlib/itegration_verb.rb', line 283

def cal_inst_index(base=0)
    if @inst_index
        if base > @inst_index
            @inst_index = base
        end
    else
        @inst_index = base
    end

    child_inst_itgt.each do |e|
        e.cal_inst_index(@inst_index + 1)
    end

end

#check_same_method(name) ⇒ Object



590
591
592
593
594
# File 'lib/tdl/exlib/itegration_verb.rb', line 590

def check_same_method(name)
    if respond_to? name.to_s
        raise TdlError.new("Itegration can't Redefine method #{name}")
    end
end

#child_inst_itgtObject



278
279
280
# File 'lib/tdl/exlib/itegration_verb.rb', line 278

def child_inst_itgt
    @child_inst_itgt ||=[]
end

#delete_silence(name) ⇒ Object



910
911
912
# File 'lib/tdl/exlib/itegration_verb.rb', line 910

def delete_silence(name)
    get_itgt_var('explort_silence_hash').delete(name.to_s)
end

#flag_match(attr) ⇒ Object

判断当前itgt class export flag 是否匹配参数



316
317
318
# File 'lib/tdl/exlib/itegration_verb.rb', line 316

def flag_match(attr)
    self.class.flag_match(attr)
end

#gen_children_modulesObject

def init_children_modules_post

blocks_hash = self.class.instance_variable_get("@_sdl_eval_blocks_post_hash_")
dir_hash = self.class.instance_variable_get("@_sdl_eval_dir_hash_")
return unless blocks_hash
blocks_hash.keys.each do |key|

    sdlm = SdlModule.new(name:self.class.to_s + "_#{@nickname}#{key}",out_sv_path:dir_hash[key])
    define_singleton_method(key) do
        sdlm
    end
end

end



390
391
392
393
394
395
396
397
# File 'lib/tdl/exlib/itegration_verb.rb', line 390

def gen_children_modules
    blocks_hash = self.class.instance_variable_get("@_sdl_eval_blocks_hash_") || {}
    blocks_hash_post = self.class.instance_variable_get("@_sdl_eval_blocks_post_hash_") || {}
    blocks_hash = blocks_hash.merge blocks_hash_post
    blocks_hash.keys.each do |key|
        self.send(key).gen_sv_module()
    end
end

#get_itgt_var(name, default = [], &block) ⇒ Object



567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
# File 'lib/tdl/exlib/itegration_verb.rb', line 567

def get_itgt_var(name,default=[],&block)
    unless instance_variable_get("@_#{name}_")
        if block_given?
            rel = block.call(default)
        else
            rel = default
        end
        instance_variable_set("@_#{name}_",rel)
        container = instance_variable_get("@_#{name}_")
    else
        container = instance_variable_get("@_#{name}_")
    end

    return container
end


680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
# File 'lib/tdl/exlib/itegration_verb.rb', line 680

def implicit_link_eval
    @top_module.implicit_itgt_collect   ||= []
    #生成link 数组便是 当前 itgt引用
    container = self.class.get_itgt_var('itegration_link_collect')
    container.each do |e|
        container_attrs = self.class.get_itgt_var('itegration_link_hash')[e]
        mark = false
        ## 先从 已经加入的隐性itgt搜索
        @top_module.implicit_itgt_collect.each do |i|
            explort_attrs = i.class.get_itgt_var('itegration_explort_collect')
            if (explort_attrs & container_attrs).sort == container_attrs.sort
                mark = true

                define_singleton_method(e) do
                    ItegrationVerbAgent.new(i)
                end
                i.implicit_link_eval
                break
            end
        end
        next if mark    ## 找到了 就处理下一个Link
        ##
        ## 如果没有找到 再从 ItegrationVerb children里面找到比加入
        @@child.each do |c|
            explort_attrs = c.get_itgt_var('itegration_explort_collect')
            if (explort_attrs & container_attrs).sort == container_attrs.sort
                isp = @top_module.add_itegration(c.to_s,nickname:'implicit',implicit:true)
                @top_module.implicit_itgt_collect << isp
                ## 如果是隐性添加,先不要加入pin_map

                define_singleton_method(e) do
                    ItegrationVerbAgent.new(isp)
                end
                mark = true
                break
            end
        end

    end
end

#init_children_modulesObject



361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
# File 'lib/tdl/exlib/itegration_verb.rb', line 361

def init_children_modules
    blocks_hash = self.class.instance_variable_get("@_sdl_eval_blocks_hash_") || {}
    blocks_hash_post = self.class.instance_variable_get("@_sdl_eval_blocks_post_hash_") || {}
    dir_hash = self.class.instance_variable_get("@_sdl_eval_dir_hash_")

    blocks_hash = blocks_hash.merge blocks_hash_post

    blocks_hash.keys.each do |key|

        sdlm = SdlModule.new(name:self.class.to_s + "_#{@nickname}#{key}",out_sv_path:dir_hash[key])
        define_singleton_method(key) do
            sdlm
        end
    end
end

#instObject

define_singleton_method(:inst) do



400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
# File 'lib/tdl/exlib/itegration_verb.rb', line 400

def inst
    # 先生成子模块
    ## 执行 生成 sdl module
    inst_child_module()

    blocks = self.class.instance_variable_get("@_inst_blocks_")
    ItegrationVerb.curr_itgt_push(self)

    if blocks.length ==  1
        block = blocks[0]
        @top_module.instance_exec(self,&block.clone)
        ItegrationVerb.curr_itgt_pop
    elsif blocks.length >  1
        # block = Proc.new do
            blocks.each do |b|
                @top_module.instance_exec(self,&b.clone)
            end
        # end
        ItegrationVerb.curr_itgt_pop
    else
        ItegrationVerb.curr_itgt_pop
        return
    end

    ## 执行 生成 sdl module
    inst_child_module_post()

    ## 执行top module techbench eval
    tb_inst()
    ## 执行测试向量
    techbench_vector()
    ## 执行 约束
    inst_constraints()
    ## 执行单元测试
    test_unit_inst()
end

#inst_child_moduleObject



489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
# File 'lib/tdl/exlib/itegration_verb.rb', line 489

def inst_child_module
    blocks_hash = self.class.instance_variable_get("@_sdl_eval_blocks_hash_")
    return unless blocks_hash
    ItegrationVerb.curr_itgt_push self
    $_implicit_curr_itgt_.with_none_itgt do 
        blocks_hash.keys.each do |key|
            sdlm = self.send(key)


            blocks = blocks_hash[key]
            if blocks.length ==  1
                block = blocks[0]
                sdlm.instance_exec(self,&block)
            elsif blocks.length >  1
                # block = Proc.new do
                    blocks.each do |b|
                        # b.call
                        sdlm.instance_exec(self,&b)
                    end
                # end
            else
                ;
            end
        end
    end
    ItegrationVerb.curr_itgt_pop
end

#inst_child_module_postObject



517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
# File 'lib/tdl/exlib/itegration_verb.rb', line 517

def inst_child_module_post
    blocks_hash = self.class.instance_variable_get("@_sdl_eval_blocks_post_hash_")
    return unless blocks_hash
    ItegrationVerb.curr_itgt_push self
    $_implicit_curr_itgt_.with_none_itgt do
        blocks_hash.keys.each do |key|
            sdlm = self.send(key)
            # $_implicit_curr_itgt_ = self

            blocks = blocks_hash[key]
            if blocks.length ==  1
                block = blocks[0]
                sdlm.instance_exec(self,&block)
            elsif blocks.length >  1
                # block = Proc.new do
                    blocks.each do |b|
                        # b.call
                        sdlm.instance_exec(self,&b)
                    end
                # end
            else
                next
            end
        end
    end
    ItegrationVerb.curr_itgt_pop
end

#inst_constraintsObject



893
894
895
896
897
898
899
900
901
902
# File 'lib/tdl/exlib/itegration_verb.rb', line 893

def inst_constraints()
    carray = self.class.get_instance_var("constraints_array")
    return unless carray
    # $_implicit_curr_itgt_ = self
    ItegrationVerb.curr_itgt_push self
    carray.each do |b|
        @top_module.constraint.instance_exec(self,&b.clone)
    end
    ItegrationVerb.curr_itgt_pop
end


597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
# File 'lib/tdl/exlib/itegration_verb.rb', line 597

def link_eval
    @top_module.implicit_itgt_collect   ||= []
    #生成link 数组便是 当前 itgt引用
    container = self.class.get_itgt_var('itegration_link_collect')
    container.each do |e|
        container_attrs = self.class.get_itgt_var('itegration_link_hash')[e]
        flag_attrs = self.class.get_itgt_var('itegration_flag_hash',{})[e]
        mark = false
        ## 先从 top_module 显式加入的itgt搜索
        @top_module.itgt_collect.each do |i|
            explort_attrs = i.class.get_itgt_var('itegration_explort_collect')
            # explort_flags = i.class.get_itgt_var('itegration_flag_collect')
            if ((explort_attrs & container_attrs).sort == container_attrs.sort  &&  i.flag_match(flag_attrs))
                mark = true
                unless self.respond_to? e
                    define_singleton_method(e) do
                        ## 如果从其他模块调用则出发 dynac_active
                        ItegrationVerbAgent.new(i)
                    end
                    i.link_eval
                    i.child_inst_itgt << self
                end
                # cal_inst_index(i)
                break
            end
        end
        if mark    ## 找到了 就处理下一个Link
            next
        else
            ## 处理 compact link
            compact_container = self.class.get_itgt_var('itegration_compact_link_collect',[])
            if compact_container.include? e
                unless self.respond_to? e
                    define_singleton_method(e) do
                        nil
                    end
                end
                next
            end
        end
        ## 先从 已经加入的隐性itgt搜索
        @top_module.implicit_itgt_collect.each do |i|
            explort_attrs = i.class.get_itgt_var('itegration_explort_collect')
            if ((explort_attrs & container_attrs).sort == container_attrs.sort && i.flag_match(flag_attrs))
                # puts "Itgt Good"
                mark = true
                unless self.respond_to? e
                    define_singleton_method(e) do
                        ## 如果从其他模块调用则出发 dynac_active
                        ItegrationVerbAgent.new(i)
                    end
                    i.link_eval
                    i.child_inst_itgt << self
                end
                break
            end
        end
        next if mark    ## 找到了 就处理下一个Link
        ## 如果没有找到 再从 ItegrationVerb children里面找到比加入
        @@child.each do |c|
            explort_attrs = c.get_itgt_var('itegration_explort_collect')
            # puts explort_attrs
            if ((explort_attrs & container_attrs).sort == container_attrs.sort && c.flag_match(flag_attrs))
                # puts "Child Good"
                isp = @top_module.add_itegration(c.to_s,nickname:'implicit',implicit:true)
                @top_module.implicit_itgt_collect << isp
                ## 如果是隐性添加,先不要加入pin_map
                define_singleton_method(e) do
                    ItegrationVerbAgent.new(isp)
                end
                isp.link_eval
                isp.child_inst_itgt << self
                mark = true
                break
            end
        end

        unless mark
            raise TdlError.new("<#{self}>没有找到符合Link 的上级 Itgt:\n    ATTR: #{container_attrs.inspect}\n    FLAG: #{flag_attrs.inspect}\n")
        end
    end
end

#set_itgt_var(name, value) ⇒ Object



583
584
585
586
587
# File 'lib/tdl/exlib/itegration_verb.rb', line 583

def set_itgt_var(name,value)
    # rel = get_itgt_var(name)
    instance_variable_set("@_#{name}_",value)
    container = instance_variable_get("@_#{name}_")
end

#tb_instObject



437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
# File 'lib/tdl/exlib/itegration_verb.rb', line 437

def tb_inst
    # define_singleton_method(:tb_inst) do
    blocks = self.class.instance_variable_get("@_inst_tb_blocks_")
    return unless blocks
    ItegrationVerb.curr_itgt_push self

    if blocks.length ==  1
        block = blocks[0]
        @top_module.techbench.instance_exec(self,&block.clone)
    elsif blocks.length >  1
        # block = Proc.new do
            blocks.each do |b|
                # b.call
                @top_module.techbench.instance_exec(self,&b.clone)
            end
        # end
    else
        ;
    end
    ItegrationVerb.curr_itgt_pop
end

#techbench_vectorObject



850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
# File 'lib/tdl/exlib/itegration_verb.rb', line 850

def techbench_vector
    ## 先获取需要激活的tb
    hash = get_itgt_var("active_techbench_vector",{})
    ## 从 class 获取 techbench_name_hash
    class_block_hash = self.class.get_instance_var('techbench_name_hash')
    ## 根据 需要激活的 tb name 激活 block
    ItegrationVerb.curr_itgt_push self
    hash.each do |key,value|
        blocks = class_block_hash[key.to_s]
        unless blocks
            raise TdlError.new("Itgt Class <#{self.class.to_s}> 没有定义 techbench <#{key}>")
        end

        tb_argvs_hash = value
        # $_implicit_curr_itgt_ = self

        if blocks.length ==  1
            block = blocks[0]
            ## 在top module 的上下文下激活blocks
            @top_module.instance_exec(self,tb_argvs_hash,&block.clone)
        elsif blocks.length >  1
            # block = Proc.new do
                blocks.each do |b|
                    # b.call
                    ## 在top module 的上下文下激活blocks
                    @top_module.instance_exec(self,tb_argvs_hash,&b.clone)
                end
            # end
        else
            next
        end

    end
    ItegrationVerb.curr_itgt_pop
end

#test_unit_instObject

测试用例 实例化



460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
# File 'lib/tdl/exlib/itegration_verb.rb', line 460

def test_unit_inst

    blocks = self.class.instance_variable_get("@_inst_test_unit_blocks_")
    return unless blocks
    return if blocks.empty?
    ItegrationVerb.curr_itgt_push self

    return unless TopModule.sim
   
    blocks.each do |b|
        # @top_module.techbench.instance_exec(self,&b.clone)
        sdlm = TestUnitModule.new(name: b[0],out_sv_path: b[1])
        $_implicit_curr_itgt_.with_none_itgt do 
            sdlm.input - "from_up_pass"
            sdlm.output.logic - "to_down_pass"
        end
        sdlm.instance_exec(self,&b[2])

        if b[1] && File.exist?(b[1])
            sdlm.gen_sv_module
        else 
            sdlm.origin_sv = true 
        end
    end

    ItegrationVerb.curr_itgt_pop

end