Class: ItegrationVerb
- Inherits:
-
Object
show all
- Extended by:
- ItegrationAttr
- Defined in:
- lib/tdl/exlib/itegration_verb.rb,
lib/tdl/exlib/itegration_verb.rb
Overview
Constant Summary
collapse
- @@child =
[]
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
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()
init_children_modules()
end
|
Instance Attribute Details
#init_inst ⇒ Object
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_index ⇒ Object
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_pool ⇒ Object
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
|
#nickname ⇒ Object
Returns the value of attribute nickname.
273
274
275
|
# File 'lib/tdl/exlib/itegration_verb.rb', line 273
def nickname
@nickname
end
|
#pins_map ⇒ Object
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_module ⇒ Object
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
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_pop ⇒ Object
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
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
names.each do |name|
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
else
_sdl_eval_blocks_hash_[name] = [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_hash_",_sdl_eval_blocks_hash_)
end
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 else
_blocks_hash_[name] = [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_ = value
instance_variable_set("@_#{name}_",_inst_ccc_)
end
|
.techbench_block(name, default_tb_argvs_hash = {}) ⇒ Object
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",{})
argvs_hash = self.get_instance_var("techbench_argvs_hash") || {}
argvs_hash[name.to_s] = default_tb_argvs_hash
set_instance_var("techbench_argvs_hash",argvs_hash)
self.define_singleton_method("#{name}_tb_eval") do |&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
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_itgt ⇒ Object
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_modules ⇒ Object
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
|
#implicit_link_eval ⇒ Object
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 ||= []
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
@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 @@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
define_singleton_method(e) do
ItegrationVerbAgent.new(isp)
end
mark = true
break
end
end
end
end
|
#init_children_modules ⇒ Object
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
|
#inst ⇒ Object
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
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
blocks.each do |b|
@top_module.instance_exec(self,&b.clone)
end
ItegrationVerb.curr_itgt_pop
else
ItegrationVerb.curr_itgt_pop
return
end
inst_child_module_post()
tb_inst()
techbench_vector()
inst_constraints()
test_unit_inst()
end
|
#inst_child_module ⇒ Object
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
blocks.each do |b|
sdlm.instance_exec(self,&b)
end
else
;
end
end
end
ItegrationVerb.curr_itgt_pop
end
|
#inst_child_module_post ⇒ Object
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)
blocks = blocks_hash[key]
if blocks.length == 1
block = blocks[0]
sdlm.instance_exec(self,&block)
elsif blocks.length > 1
blocks.each do |b|
sdlm.instance_exec(self,&b)
end
else
next
end
end
end
ItegrationVerb.curr_itgt_pop
end
|
#inst_constraints ⇒ Object
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
ItegrationVerb.curr_itgt_push self
carray.each do |b|
@top_module.constraint.instance_exec(self,&b.clone)
end
ItegrationVerb.curr_itgt_pop
end
|
#link_eval ⇒ Object
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 ||= []
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_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))
mark = true
unless self.respond_to? e
define_singleton_method(e) do
ItegrationVerbAgent.new(i)
end
i.link_eval
i.child_inst_itgt << self
end
break
end
end
if mark next
else
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
@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))
mark = true
unless self.respond_to? e
define_singleton_method(e) do
ItegrationVerbAgent.new(i)
end
i.link_eval
i.child_inst_itgt << self
end
break
end
end
next if mark @@child.each do |c|
explort_attrs = c.get_itgt_var('itegration_explort_collect')
if ((explort_attrs & container_attrs).sort == container_attrs.sort && c.flag_match(flag_attrs))
isp = @top_module.add_itegration(c.to_s,nickname:'implicit',implicit:true)
@top_module.implicit_itgt_collect << isp
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)
instance_variable_set("@_#{name}_",value)
container = instance_variable_get("@_#{name}_")
end
|
#tb_inst ⇒ Object
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
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
blocks.each do |b|
@top_module.techbench.instance_exec(self,&b.clone)
end
else
;
end
ItegrationVerb.curr_itgt_pop
end
|
#techbench_vector ⇒ Object
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
hash = get_itgt_var("active_techbench_vector",{})
class_block_hash = self.class.get_instance_var('techbench_name_hash')
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
if blocks.length == 1
block = blocks[0]
@top_module.instance_exec(self,tb_argvs_hash,&block.clone)
elsif blocks.length > 1
blocks.each do |b|
@top_module.instance_exec(self,tb_argvs_hash,&b.clone)
end
else
next
end
end
ItegrationVerb.curr_itgt_pop
end
|
#test_unit_inst ⇒ Object
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|
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
|