Class: Port

Inherits:
BDNode show all
Defined in:
lib/tecsgen/core/componentobj.rb,
lib/tecsgen/core/tecsinfo.rb

Overview

構文要素:口を表すクラス(セルタイプの呼び口、受け口)

Instance Method Summary collapse

Methods inherited from BDNode

#get_owner, #set_owner

Methods inherited from Node

#cdl_error, #cdl_error2, #cdl_error3, #cdl_info, #cdl_info2, #cdl_warning, #cdl_warning2, #get_locale, #locale_str, #set_locale

Constructor Details

#initialize(name, sig_path, port_type, array_size = nil, reverse_require_cell_path = nil, reverse_require_entry_port_name = nil) ⇒ Port

@b_skelton_useless

bool # スケルトン関数不要



3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
# File 'lib/tecsgen/core/componentobj.rb', line 3938

def initialize(name, sig_path, port_type, array_size = nil, reverse_require_cell_path = nil, reverse_require_entry_port_name = nil)
  super()
  @name = name
  @port_type = port_type

  if array_size == "[]"
#      if port_type == :ENTRY then
#        cdl_error( "S1072 $1: entry port: sizeless array not supported in current version" , name )
#      end
    @array_size = array_size
  elsif array_size
    if array_size.is_a? Expression
      @array_size = array_size.eval_const(nil)
    else
      @array_size = array_size # これはアロケータ呼び口の場合(元の呼び口で既に評価済み)
    end
    if @array_size.nil?
      cdl_error("S1073 Not constant expression $1", array_size.to_s)
    end

    # if Integer( @array_size ) != @array_size || @array_size <= 0 then
    if !@array_size.is_a? Integer
      cdl_error("S1074 Not Integer $1", array_size.to_s)
    end

  end

  object = Namespace.find(sig_path) # 1
  if object.nil?
    # mikan signature の名前が不完全
    cdl_error("S1075 \'$1\' signature not found", sig_path)
  elsif !object.instance_of?(Signature)
    # mikan signature の名前が不完全
    cdl_error("S1076 \'$1\' not signature", sig_path)
  else
    @signature = object

  end

  # 逆require
  @reverse_require_cell_path       = nil
  @reverse_require_entry_port_name = nil
  if reverse_require_cell_path
    if port_type == :CALL
      cdl_error("S1152 $1 call port cannot have fixed join", @name)
    else
      @reverse_require_cell_path       = reverse_require_cell_path
      @reverse_require_entry_port_name = reverse_require_entry_port_name

      # 受け口配列か?
      if array_size
        cdl_error("S1153 $1: cannot be entry port array for fixed join port", @name)
      end

      # 呼び口のセルタイプを探す
      ct_or_cell = Namespace.find(@reverse_require_cell_path) # 1
      if ct_or_cell.instance_of? Cell
        ct = ct_or_cell.get_celltype
      elsif ct_or_cell.instance_of? Celltype
        ct = ct_or_cell
        if !ct.is_singleton?
          cdl_error("S1154 $1: must be singleton celltype for fixed join", @reverse_require_cell_path.to_s)
        end
      else
        ct = nil
        cdl_error("S1155 $1: not celltype or not found", @reverse_require_cell_path.get_path_str)
      end

      if ct.nil?
        return # 既にエラー
      end

      # 添え字なしの呼び口配列か?
      port = ct.find(@reverse_require_entry_port_name)
      if port.nil? || port.get_port_type != :CALL
        cdl_error("S1156 $1: not call port or not found", @reverse_require_entry_port_name)
      else
        if port.get_array_size != "[]"
          cdl_error("S1157 $1: sized array or not array", @reverse_require_entry_port_name)
        end
      end

    end
  end

  @b_require = false
  @b_has_name = false
  @b_inline = false
  @b_optional = false
  @b_omit = false
  @b_ref_desc = false
  @b_dynamic = false
  reset_optimize
end

Instance Method Details

#create_reverse_require_join(cell) ⇒ Object

Port# 逆require の結合を生成する

STAGE: S



4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
# File 'lib/tecsgen/core/componentobj.rb', line 4442

def create_reverse_require_join(cell)
  if @reverse_require_cell_path.nil?
    return
  end

  # 呼び元セルを探す
  ct_or_cell = Namespace.find(@reverse_require_cell_path) # mikan namespace    #1
  if ct_or_cell.instance_of? Cell
    cell2 = ct_or_cell
    ct = cell2.get_celltype
    if ct.nil?
      return # 既にエラー
    end
  elsif ct_or_cell.instance_of? Celltype
    cell2 = ct_or_cell.get_singleton_cell(cell.get_region)
    if cell2.nil?
      cdl_error("S1158 $1: singleton cell not found for fixed join", ct_or_cell.get_name)
      return
    end
    ct = ct_or_cell
  else
    # 既にエラー:無視
    return
  end

  # 結合を生成する
  dbgPrint "create_reverse_require_join #{cell2.get_name}.#{@reverse_require_entry_port_name}[] = #{cell.get_name}.#{@name}"
  nsp = NamespacePath.new(cell.get_name, false, cell.get_namespace)
#    rhs = Expression.new( [ :OP_DOT, [ :IDENTIFIER, Token.new( cell.get_name, nil, nil, nil ) ],
  rhs = Expression.new([:OP_DOT, [:IDENTIFIER, nsp],
                          Token.new(@name, nil, nil, nil)], cell.get_locale) # 1
  join = Join.new(@reverse_require_entry_port_name, -1, rhs, cell.get_locale)
  cell2.new_join(join)
  join.set_definition(ct.find(join.get_name))
end

#each_paramObject

Port# signature のすべての関数のすべてのパラメータをたどる

block

ブロックを引数として取る(ruby の文法で書かない)

ブロックは3つの引数を受け取る(Port, Decl,      ParamDecl)    Decl: 関数ヘッダ

Signature クラスにも each_param がある(同じ働き)



4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
# File 'lib/tecsgen/core/componentobj.rb', line 4482

def each_param # ブロック引数{  |port, func_decl, param_decl| }
  return if @signature.nil?                         # signature 未定義(既にエラー)
  fha = @signature.get_function_head_array            # 呼び口または受け口のシグニチャの関数配列
  return if fha.nil?                                # nil なら文法エラーで有効値が設定されなかった

  pr = Proc.new   # このメソッドのブロック引数を pr に代入
  port = self
  fha.each{|fh|  # fh: FuncHead                      # 関数配列中の各関数頭部
    fd = fh.get_declarator # fd: Decl  (関数頭部からDeclarotorを得る)
    if fd.is_function? # fd が関数でなければ、すでにエラー
      fd.get_type.get_paramlist.get_items.each{|par| # すべてのパラメータについて
        pr.call(port, fd, par)
      }
    end
  }
end

#get_allocator_func_declObject



4100
4101
4102
# File 'lib/tecsgen/core/componentobj.rb', line 4100

def get_allocator_func_decl
  @allocator_func_decl
end

#get_allocator_instanceObject



4432
4433
4434
# File 'lib/tecsgen/core/componentobj.rb', line 4432

def get_allocator_instance
  return @allocator_instance
end

#get_allocator_instance_tmpObject



4436
4437
4438
# File 'lib/tecsgen/core/componentobj.rb', line 4436

def get_allocator_instance_tmp
  return @allocator_instance_tmp
end

#get_allocator_param_declObject



4104
4105
4106
# File 'lib/tecsgen/core/componentobj.rb', line 4104

def get_allocator_param_decl
  @allocator_param_decl
end

#get_allocator_portObject



4096
4097
4098
# File 'lib/tecsgen/core/componentobj.rb', line 4096

def get_allocator_port
  @allocator_port
end

#get_array_sizeObject



4073
4074
4075
# File 'lib/tecsgen/core/componentobj.rb', line 4073

def get_array_size
  @array_size
end

#get_celltypeObject



4077
4078
4079
# File 'lib/tecsgen/core/componentobj.rb', line 4077

def get_celltype
  @celltype
end

#get_nameObject



4061
4062
4063
# File 'lib/tecsgen/core/componentobj.rb', line 4061

def get_name
  @name
end

#get_port_typeObject



4065
4066
4067
# File 'lib/tecsgen/core/componentobj.rb', line 4065

def get_port_type
  @port_type
end

#get_real_callee_cellObject

Port# 唯一の結合先セルを返す(compositeの場合実セル)

optional 呼び口で未結合の場合 nil を返す



4426
4427
4428
4429
4430
# File 'lib/tecsgen/core/componentobj.rb', line 4426

def get_real_callee_cell
  if @only_callee_cell
    return @only_callee_cell.get_real_cell(@only_callee_port.get_name)
  end
end

#get_real_callee_portObject

Port# 唯一の結合先ポートを返す(compositeの場合実セル)

optional 呼び口で未結合の場合 nil を返す



4418
4419
4420
4421
4422
# File 'lib/tecsgen/core/componentobj.rb', line 4418

def get_real_callee_port
  if @only_callee_cell
    return @only_callee_cell.get_real_port(@only_callee_port.get_name)
  end
end

#get_signatureObject



4069
4070
4071
# File 'lib/tecsgen/core/componentobj.rb', line 4069

def get_signature
  @signature
end

#has_name?Boolean

Port# require 呼び口が名前を持つ?

require 限定

Returns:

  • (Boolean)


4119
4120
4121
# File 'lib/tecsgen/core/componentobj.rb', line 4119

def has_name?
  @b_has_name
end

#is_allocator_port?Boolean

Returns:

  • (Boolean)


4092
4093
4094
# File 'lib/tecsgen/core/componentobj.rb', line 4092

def is_allocator_port?
  @allocator_port != nil
end

#is_cell_unique?Boolean

呼び先のセルは一つ?

Returns:

  • (Boolean)


4390
4391
4392
# File 'lib/tecsgen/core/componentobj.rb', line 4390

def is_cell_unique? # 呼び先のセルは一つ?
  @b_cell_unique
end

#is_dynamic?Boolean

Port# is_dynamic?

Returns:

  • (Boolean)


4505
4506
4507
# File 'lib/tecsgen/core/componentobj.rb', line 4505

def is_dynamic?
  @b_dynamic
end

#is_inline?Boolean

Returns:

  • (Boolean)


4366
4367
4368
# File 'lib/tecsgen/core/componentobj.rb', line 4366

def is_inline?
  @b_inline
end

#is_omit?Boolean

Port# omit 指定されている?

Returns:

  • (Boolean)


4132
4133
4134
# File 'lib/tecsgen/core/componentobj.rb', line 4132

def is_omit?
  @b_omit || (@signature && @signature.is_empty?)
end

#is_optional?Boolean

Returns:

  • (Boolean)


4123
4124
4125
# File 'lib/tecsgen/core/componentobj.rb', line 4123

def is_optional?
  @b_optional
end

#is_ref_desc?Boolean

Port# is_ref_desc?

Returns:

  • (Boolean)


4510
4511
4512
# File 'lib/tecsgen/core/componentobj.rb', line 4510

def is_ref_desc?
  @b_ref_desc
end

#is_require?Boolean

Returns:

  • (Boolean)


4113
4114
4115
# File 'lib/tecsgen/core/componentobj.rb', line 4113

def is_require?
  @b_require
end

#is_reverse_required?Boolean

Port# 逆require指定されている?

Returns:

  • (Boolean)


4500
4501
4502
# File 'lib/tecsgen/core/componentobj.rb', line 4500

def is_reverse_required?
  @reverse_require_cell_path != nil
end

#is_skelton_useless?Boolean

スケルトン関数不要 (true の時、受け口関数を呼出す)

Returns:

  • (Boolean)


4380
4381
4382
4383
4384
4385
4386
4387
4388
# File 'lib/tecsgen/core/componentobj.rb', line 4380

def is_skelton_useless? # スケルトン関数不要   (true の時、受け口関数を呼出す)
  if @port_type == :ENTRY && $unopt_entry == true
    # プラグインから $unopt_entry を設定するケースのため
    # ここで読み出すときに、false を返す (reset_optimize での設定変更は速すぎる)
    return false
  else
    return @b_skelton_useless
  end
end

#is_VMT_useless?Boolean

VMT 関数テーブルを使用しない

Returns:

  • (Boolean)


4370
4371
4372
4373
4374
4375
4376
4377
4378
# File 'lib/tecsgen/core/componentobj.rb', line 4370

def is_VMT_useless? # VMT 関数テーブルを使用しない
  if @port_type == :ENTRY && $unopt_entry == true
    # プラグインから $unopt_entry を設定するケースのため
    # ここで読み出すときに、false を返す (reset_optimize での設定変更は速すぎる)
    return false
  else
    return @b_VMT_useless
  end
end


549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
# File 'lib/tecsgen/core/tecsinfo.rb', line 549

def print_info(f, ct_global, indent)
  return if @signature.nil? # signature not found error in cdl
  if @port_type == :ENTRY
    f.print <<EOT
#{indent}cell nTECSInfo::tEntryInfo #{ct_global}_#{@name}EntryInfo{
#{indent}    name            = "#{@name}";
#{indent}    cSignatureInfo  = #{@signature.get_global_name}SignatureInfo.eSignatureInfo;
#{indent}    b_inline        = #{@b_inline};
#{indent}    array_size      = C_EXP( "#{ct_global}_#{@name}__array_size" );
#{indent}};
EOT
  else
    f.print <<EOT
#{indent}cell nTECSInfo::tCallInfo #{ct_global}_#{@name}CallInfo{
#{indent}    name            = "#{@name}";
#{indent}    cSignatureInfo  = #{@signature.get_global_name}SignatureInfo.eSignatureInfo;
#{indent}    offset            = C_EXP( "#{ct_global}_#{@name}__offset" );
#{indent}    array_size        = C_EXP( "#{ct_global}_#{@name}__array_size" );
#{indent}    b_optional        = #{@b_optional};
#{indent}    b_omit            = #{@b_omit};
#{indent}    b_dynamic         = #{@b_dynamic};
#{indent}    b_ref_desc        = #{@b_ref_desc};
#{indent}    b_allocator_port  = #{!@allocator_port.nil? ? true : false};
#{indent}    b_require_port    = #{@b_require};
#{indent}    place             = C_EXP( "#{ct_global}_#{@name}__place" );
#{indent}    b_VMT_useless     = C_EXP( "#{ct_global}_#{@name}__b_VMT_useless" );
#{indent}    b_skelton_useless = C_EXP( "#{ct_global}_#{@name}__b_skelton_useless" );
#{indent}    b_cell_unique     = C_EXP( "#{ct_global}_#{@name}__b_cell_unique" );

#{indent}};
EOT
  end
end

#reset_optimizeObject

Port#最適化に関する変数をリセットする

Region ごとに最適化のやりなおしをするため、リセットする



4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
# File 'lib/tecsgen/core/componentobj.rb', line 4035

def reset_optimize
    if @port_type == :CALL
      # call port optimize
      @b_VMT_useless = false                     # VMT 不要 (true の時 VMT を介することなく呼出す)
      @b_skelton_useless = false                 # スケルトン関数不要   (true の時、受け口関数を呼出す)
      @b_cell_unique = false                     # 唯一の呼び先セル
      @only_callee_port = nil                    # 唯一の呼び先ポート
      @only_callee_cell = nil                    # 唯一の呼び先セル
    else
      # entry port optimize
      if $unopt || $unopt_entry
        # 最適化なし
        @b_VMT_useless = false                     # VMT 不要 (true の時 VMT を介することなく呼出す)
        @b_skelton_useless = false                 # スケルトン関数不要   (true の時、受け口関数を呼出す)
      else
        # 最適化あり
        @b_VMT_useless = true                      # VMT 不要 (true の時 VMT を介することなく呼出す)
        @b_skelton_useless = true                  # スケルトン関数不要   (true の時、受け口関数を呼出す)
      end
    end
end

#set_allocator_instanceObject

Port# リレーアロケータ、内部アロケータのインスタンスを設定

呼び口の前方参照可能なように、セルタイプの解釈の最後で行う



4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
# File 'lib/tecsgen/core/componentobj.rb', line 4221

def set_allocator_instance
  if @allocator_instance_tmp.nil?
    return
  end

  @allocator_instance = {}
  @allocator_instance_tmp.each {|ai|
    direction = nil
    alloc_type = ai[0]
    # ai = [ :INTERNAL_ALLOC|:RELAY_ALLOC, func_name, param_name, rhs ]
    case alloc_type
    when :INTERNAL_ALLOC
      if !@owner.instance_of? CompositeCelltype # ミスを防ぐために composite でなければとした
        cdl_error("S1081 self allocator not supported yet") # mikan これはサポートされているはず。要調査 12/1/15
        next
      end
      # OK
    when :RELAY_ALLOC
      # OK
    when :NORMAL_ALLOC
      # ここへ来るのは composite の受け口で右辺が "eEnt.func.param" 形式で指定されていた場合
      cdl_error("S1174 $1 not suitable for lhs, suitable lhs: 'func.param'", "#{ai[1]}.#{ai[3]}.#{ai[4]}")
      next
    else
      raise "Unknown allocator type #{ai[1]}"
    end

    # '=' 左辺(func_name,param_name)は実在するか?
    if @signature # signature = nil なら既にエラー
      fh = @signature.get_function_head(ai[1])
      if fh.nil?
        cdl_error("S1082 function \'$1\' not found in signature", ai[1])
        next
      end
      decl = fh.get_declarator
      if !decl.is_function?
        next # 既にエラー
      end
      paramdecl = decl.get_type.get_paramlist.find(ai[2])
      if paramdecl.nil?
        cdl_error("S1083 \'$1\' not found in function \'$2\'", ai[2], ai[1])
        next
      end
      case paramdecl.get_direction
      when :SEND, :RECEIVE
        # OK
        direction = paramdecl.get_direction
      else
        cdl_error("S1084 \'$1\' in function \'$2\' is not send or receive", ai[2], ai[1])
        next
      end
    end

    # 重複指定がないか?
    if @allocator_instance["#{@name}_#{ai[1]}_#{ai[2]}"]
      cdl_error("S1085 duplicate allocator specifier for \'$1_$2\'", ai[1], ai[2])
    end

    # 右辺のチェック
    case alloc_type
    when :INTERNAL_ALLOC

      ele = ai[3].get_elements
      if ele[0] != :IDENTIFIER
        cdl_error("S1086 $1: rhs not in 'allocator_entry_port' form", ai[3].to_s)
        next
      end

      ep_name = ele[1] # アロケータ受け口名
      ep = @owner.find ep_name.get_path[0] # mikan "a::b"
      if ep.nil? || !ep.instance_of?(Port) || ep.get_port_type != :ENTRY || !ep.get_signature.is_allocator?
        cdl_error("S1175 $1 not found or not allocator entry port for $2", ep_name, ai[1])
      end
      # 右辺チェック終わり
      # ai2 = [ :INTERNAL_ALLOC, func_name, param_name, rhs_ep_name ]
      ai2 = [ai[0], ai[1], ai[2], ep_name]

    when :RELAY_ALLOC
      ele = ai[3].get_elements
      if ele[0] != :OP_DOT ||
          ele[1][0] != :OP_DOT || ele[1][1][0] != :IDENTIFIER || !ele[1][1][1].is_name_only? ||
          !ele[1][2].instance_of?(Token) || !ele[2].instance_of?(Token) # 1
        # [ :OP_DOT, [ :OP_DOT, [ :IDENTIFIER,  name_space_path ],  Token(1) ],  Token(2) ]
        #    ele[0]    ele[1][0]  ele[1][1][0]  ele[1][1][1]        ele[1][2]    ele[2]
        #      name_space_path.Token(1).Token(2) === call_port.func.param
        #  mikan Expression#analyze_cell_join_expression の変種を作成して置き換えるべき

        cdl_error("S1176 rhs not in 'call_port.func.param' form for for $1_$2", ai[1], ai[2]) # S1086
        next
      end
      func_name = ele[1][2]
      cp_name = ele[1][1][1].get_name
      param_name = ele[2].to_sym
      cp = @owner.find cp_name # リレーする先の呼び口
      if cp
# mikan cp が呼び口であることのチェック(属性の場合もある)
# mikan 受け口から受け口へのリレーへの対応 (呼び口から呼び口へのリレーはありえない)  <=== 文法にかかわる事項(呼び口側でアロケータが決定される)
        sig = cp.get_signature
        if sig && @signature
          fh = @signature.get_function_head(func_name)
          if fh.nil?
            cdl_error("S1087 function \'$1\' not found in signature \'$2\'", func_name, sig.get_name)
            next
          end
          decl = fh.get_declarator
          if !decl.is_function?
            next # 既にエラー
          end
          paramdecl = decl.get_type.get_paramlist.find(param_name)
          if paramdecl.nil?
            cdl_error("S1088 \'$1\' not found in function \'$2\'", param_name, func_name)
            next
          end
          case paramdecl.get_direction
          when :SEND, :RECEIVE
            # OK
            if alloc_type == :RELAY_ALLOC && direction != paramdecl.get_direction
              cdl_error("S1089 relay allocator send/receive mismatch between $1.$2 and $3_$4.$5", ai[1], ai[2], cp_name, func_name, param_name)
            end
          else
            cdl_error("S1090 \'$1\' in function \'$2\' is not send or receive", param_name, func_name)
            next
          end

          # else
          # sig == nil ならば既にエラー
        end
      else
        if @celltype
          ct_name = @celltype.get_name
        else
          ct_name = "(None)"
        end
        cdl_error("S1091 call port \'$1\' not found in celltype $2", cp_name, ct_name)
        next
      end
      # 右辺チェック終わり
      # ai2 = [ :RELAY_ALLOC, func_name, param_name, rhs_cp_name, rhs_func_name, rhs_param_name ]
      ai2 = [ai[0], ai[1], ai[2], cp_name, func_name, param_name]
    end # case alloc_type

    @allocator_instance["#{@name}_#{ai[1]}_#{ai[2]}"] = ai2
  }
end

#set_allocator_port(port, fd, par) ⇒ Object

Port# アロケータポートの設定

port

Port : send/receive のあった呼び口または受け口

fd

Decl : 関数の declarator

par

ParamDecl : send/receive のあった引数

この呼び口が生成されるもとになった呼び口または受け口の情報を設定



4086
4087
4088
4089
4090
# File 'lib/tecsgen/core/componentobj.rb', line 4086

def set_allocator_port(port, fd, par)
  @allocator_port = port
  @allocator_func_decl = fd
  @allocator_param_decl = par
end

#set_cell_uniqueObject

呼び先セルは一つだけ



4148
4149
4150
# File 'lib/tecsgen/core/componentobj.rb', line 4148

def set_cell_unique                     # 呼び先セルは一つだけ
  @b_cell_unique = true
end

#set_celltype(celltype) ⇒ Object



4057
4058
4059
# File 'lib/tecsgen/core/componentobj.rb', line 4057

def set_celltype(celltype)
  @celltype = celltype
end

#set_entry_VMT_skelton_useless(b_VMT_useless, b_skelton_useless) ⇒ Object

Port# 受け口最適化の設定

この受け口を参照する呼び口が VMT, skelton を必要としているかどうかを設定 一つでも呼び口が必要としている(すなわち b_*_useless が false)場合は、 この受け口の最適化を false とする



4398
4399
4400
4401
4402
4403
4404
4405
# File 'lib/tecsgen/core/componentobj.rb', line 4398

def set_entry_VMT_skelton_useless(b_VMT_useless, b_skelton_useless)
  if !b_VMT_useless
    @b_VMT_useless = false
  end
  if !b_skelton_useless
    @b_skelton_useless = false
  end
end

#set_omitObject



4136
4137
4138
# File 'lib/tecsgen/core/componentobj.rb', line 4136

def set_omit
  @b_omit = true
end

#set_only_callee(callee_port, callee_cell) ⇒ Object

Port# 唯一の結合先を設定

最適化で使用

b_VMT_useless == true || b_skelton_useless == true の時に設定される
optional の場合 callee_cell, callee_port が nil となる


4411
4412
4413
4414
# File 'lib/tecsgen/core/componentobj.rb', line 4411

def set_only_callee(callee_port, callee_cell)
  @only_callee_port = callee_port
  @only_callee_cell = callee_cell
end

#set_optionalObject



4127
4128
4129
# File 'lib/tecsgen/core/componentobj.rb', line 4127

def set_optional
  @b_optional = true
end

#set_require(b_has_name) ⇒ Object



4108
4109
4110
4111
# File 'lib/tecsgen/core/componentobj.rb', line 4108

def set_require(b_has_name)
  @b_require = true
  @b_has_name = b_has_name
end

#set_skelton_uselessObject

スケルトン関数不要 (true の時、受け口関数を呼出す)



4144
4145
4146
# File 'lib/tecsgen/core/componentobj.rb', line 4144

def set_skelton_useless                 # スケルトン関数不要   (true の時、受け口関数を呼出す)
  @b_skelton_useless = true
end

#set_specifier(spec_list) ⇒ Object

Port# 呼び口/受け口の指定子の設定

inline, allocator の指定



4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
# File 'lib/tecsgen/core/componentobj.rb', line 4154

def set_specifier(spec_list)
  spec_list.each {|s|
    case s[0]
    when :INLINE
      if @port_type == :CALL
        cdl_error("S1077 inline: cannot be specified for call port")
        next
      end
      @b_inline = true
    when :OMIT
      if @port_type == :ENTRY
        cdl_error("S9999 omit: cannot be specified for entry port")
        next
      end
      @b_omit = true
    when :OPTIONAL
      if @port_type == :ENTRY
        cdl_error("S1078 optional: cannot be specified for entry port")
        next
      end
      @b_optional = true
    when :REF_DESC
      if @port_type == :ENTRY
        cdl_error("S9999 ref_desc: cannnot be specified for entry port")
        next
      end
      @b_ref_desc = true
    when :DYNAMIC
      if @port_type == :ENTRY
        cdl_error("S9999 dynamic: cannnot be specified for entry port")
        next
      end
      @b_dynamic = true
    when :ALLOCATOR
      if @port_type == :CALL
        cdl_error("S1079 allocator: cannot be specified for call port")
      end
      if @allocator_instance_tmp
        cdl_error("S1080 duplicate allocator specifier")
        next
      end
      @allocator_instance_tmp = s[1]
    else
      raise "unknown specifier #{s[0]}"
    end
  }
  if @b_dynamic || @b_ref_desc
    if @b_dynamic
      dyn_ref = "dynamic"
    else
      dyn_ref = "ref_desc"
    end
    if @b_omit # is_omit? は is_empty? も含んでいるので使えない
      cdl_error("S9999 omit cannot be specified with $1", dyn_ref)
    elsif @signature && @signature.is_empty?
      cdl_error("S9999 $1 cannot be specified for empty signature", dyn_ref)
    elsif @signature && @signature.has_descriptor?
      # cdl_error( "S9999 $1 port '$2' cannot have Descriptor in its signature", dyn_ref, @name )
    end

  elsif @b_dynamic && @b_ref_desc
    cdl_error("S9999 both dynamic & ref_desc cannot be specified simultaneously")
  end
end

#set_VMT_uselessObject

VMT 関数テーブルを使用しない



4140
4141
4142
# File 'lib/tecsgen/core/componentobj.rb', line 4140

def set_VMT_useless                     # VMT 関数テーブルを使用しない
  @b_VMT_useless = true
end

#show_tree(indent) ⇒ Object



4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
# File 'lib/tecsgen/core/componentobj.rb', line 4514

def show_tree(indent)
  indent.times { print "  " }
  puts "Port: name:#{@name} port_type:#{@port_type} require:#{@b_require} inline:#{@b_inline} omit:#{@b_omit} optional:#{@b_optional} ref_desc:#{@b_ref_desc} dynamic:#{@b_dynamic}"
  (indent + 1).times { print "  " }
  if @signature
    puts "signature: #{@signature.get_name} #{@signature}"
  else
    puts "signature: NOT defined"
  end
  if @array_size == "[]"
    (indent + 1).times { print "  " }
    puts "array_size: not specified"
  elsif @array_size
    (indent + 1).times { print "  " }
    puts "array_size: #{@array_size}"
  end
  if @allocator_instance
    (indent + 1).times { print "  " }
    puts "allocator instance:"
    @allocator_instance.each {|b, a|
      (indent + 2).times { print "  " }
      puts "#{a[0]} #{a[1]} #{b} "
      # a[3].show_tree( indent+3 )
    }
  end
  (indent + 1).times { print "  " }
  if @port_type == :CALL
    puts "VMT_useless : #{@b_VMT_useless}  skelton_useless : #{@b_skelton_useless}  cell_unique : #{@b_cell_unique}"
  else
    puts "VMT_useless : #{@b_VMT_useless}  skelton_useless : #{@b_skelton_useless}"
  end
end