Class: ATK1EventPlugin

Inherits:
CelltypePlugin show all
Defined in:
lib/tecsgen/plugin/ATK1EventPlugin.rb

Overview

ATK1 Event celltype プラグインクラス

Constant Summary collapse

@@instancies =
@@instancies

:セル実体群

[]

Constants inherited from Plugin

Plugin::PluginArgProc

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CelltypePlugin

#gen_factory

Methods inherited from Plugin

#cdl_error, #check_plugin_arg, #gen_cdl_file, #gen_ep_func?, #gen_postamble, #gen_preamble, #parse_plugin_arg, #print_msg, #set_locale, #set_silent

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(celltype, option) ⇒ ATK1EventPlugin

初期化

全てのセルの実体を意味解析後に参照する必要があるために
初期化時に singleton  instancies に格納する
signature

Celltype シグニチャ(インスタンス)



48
49
50
51
# File 'lib/tecsgen/plugin/ATK1EventPlugin.rb', line 48

def initialize(celltype, option)
  super
  @@instancies << self
end

Class Method Details

.gen_post_code(file) ⇒ Object

意味解析実行後のコード生成



58
59
60
61
62
# File 'lib/tecsgen/plugin/ATK1EventPlugin.rb', line 58

def self.gen_post_code(file)
  @@instancies.each {|inst|
    inst.gen_oil_code file
  }
end

Instance Method Details

#gen_oil_code(file) ⇒ Object

OILファイル出力



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/tecsgen/plugin/ATK1EventPlugin.rb', line 65

def gen_oil_code(file)
  file2 = CFile.open("#{$gen}/EVENT_tecsgen.oil", "w")

  whole_mask = 0

  # EVENT
  @celltype.get_cell_list.each {|cell|

#      if cell.is_generate?
    join = cell.get_join_list.get_item(:mask)

      # AUTO type search and change to zero
      if join
        # mask_bit = join.get_rhs.to_s.eval_cnst( nil )
        mask_bit = join.get_rhs.to_s.to_i
        mask_str = join.get_rhs.to_s
        if mask_str == "AUTO"
          new_rhs = Expression.create_integer_constant(32, @locale)
          join.change_rhs new_rhs
        else
          mask_pattern = 1 << mask_bit
          whole_mask |= mask_pattern
        end
      else
        new_rhs = Expression.create_integer_constant(32, @locale)
        join = Join.new(:mask, nil, new_rhs)
        cell.new_join(join)
      end

#        file2.print "\t /* working #{join.get_rhs.to_s} */\n"
#      end

  }

  mask_count = 0
  mask_place = 0

  @celltype.get_cell_list.each {|cell|

#      if cell.is_generate?
      # bit place to mask pattern
    file2.print "\tEVENT #{cell.get_name} {\n"
      join = cell.get_join_list.get_item(:mask)
      if join
        mask_bit = join.get_rhs.to_s.to_i
        if mask_bit == 32
          while 1
            p("mask_count, current_mask")
  p mask_count
            current_mask = (1 << mask_count)
  p current_mask
            if 0 == whole_mask & current_mask
              new_rhs = Expression.create_integer_constant(current_mask, @locale)
              join.change_rhs new_rhs
              whole_mask = whole_mask | current_mask
              mask_place = mask_count
              break
            end
            if current_mask >= 0x8000
              mask_place = 0
              break
            end
            mask_count = mask_count + 1
          end
        else
          mask_place = join.get_rhs.to_s.to_i
          current_mask = 1 << mask_place
          new_rhs = Expression.create_integer_constant(current_mask, @locale)
          join.change_rhs new_rhs
        end
        file2.print "\t\tMASK = #{mask_place};\n"
      end

      file2.print "\t};\n"
      file2.print "\n"

#      end

  }

  file2.close
end

#new_cell(cell) ⇒ Object

cellの生成



54
55
# File 'lib/tecsgen/plugin/ATK1EventPlugin.rb', line 54

def new_cell(cell)
end