Class: HRPHandlerPlugin

Inherits:
HRPKernelObjectPlugin show all
Defined in:
lib/tecsgen/plugin/HRPHandlerPlugin.rb

Overview

celltype プラグインの共通の親クラス

Constant Summary

Constants inherited from Plugin

Plugin::PluginArgProc

Instance Method Summary collapse

Methods inherited from HRPKernelObjectPlugin

check_referenced_cells, #gen_factory, get_celltype_list, include_celltype?, include_region, #initialize, isChecked, set_celltype, set_region_list

Methods inherited from CelltypePlugin

#gen_factory, gen_post_code, #initialize

Methods inherited from Plugin

#cdl_error, #check_plugin_arg, #gen_cdl_file, #gen_ep_func?, #gen_postamble, #gen_preamble, #initialize, #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, #initialize, #locale_str, #set_locale

Constructor Details

This class inherits a constructor from HRPKernelObjectPlugin

Instance Method Details

#new_cell(cell) ⇒ Object

oyama: add to avoid Ruby exception in code generation phase.



45
46
47
48
49
50
# File 'lib/tecsgen/plugin/HRPHandlerPlugin.rb', line 45

def new_cell(cell)
  domainOption = cell.get_region.get_domain_root.get_domain_type.get_option
    if (domainOption == "OutOfDomain") || (domainOption != "kernel")
      cdl_error("HRP9999 HRP handler '$1' must belong to kernel domain", cell.get_name)
    end
end

file : output file (ex.tecsgen.cfg) cell : val : tab :



58
59
60
61
62
63
64
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
# File 'lib/tecsgen/plugin/HRPHandlerPlugin.rb', line 58

def print_cfg_cre(file, cell, val, tab)
  if !val[:id].nil?
    val[:id] = val[:id].gsub(/(^|[^\$])\$id\$/, "\\1#{@celltype.get_name}_#{cell.get_name}")
  end
    # $cbp$の代わり
    index = cell.get_id - @celltype.get_id_base
    # cell_CB_name = "#{@celltype.get_global_name}_CB_tab[#{index}]"
    name_array = cell.get_celltype.get_name_array cell
    cell_CBP = name_array[8]
    # CRE_XXXの生成
    domainOption = cell.get_region.get_domain_root.get_domain_type.get_option
    if (domainOption == "OutOfDomain") || (domainOption != "kernel")
        # 無所属 or ユーザドメインに属する場合
      raise "#{@plugin_arg_str.to_s.downcase} handler #{val[:id]} must belong to kernel domain."
    elsif @plugin_arg_str == "CONFIG_INT"
      file.print <<EOT
#{tab}CFG_INT( #{val[:interruptNumber]}, { #{val[:attribute]}, #{val[:interruptPriority]} });
EOT
    elsif @plugin_arg_str == "ISR"
      file.print <<EOT
#{tab}CRE_ISR(#{val[:id]}, { #{val[:attribute]}, #{cell_CBP}, #{val[:interruptNumber]}, tISR_start, #{val[:isrPriority]} });
EOT
    elsif @plugin_arg_str == "DEF_INH"
      name_array = @celltype.get_name_array cell
        start = @celltype.subst_name("$id$_start", name_array)
        file.print <<EOT
#{tab}DEF_INH(#{val[:interruptHandlerNumber]}, { #{val[:attribute]}, #{start} });
EOT
    elsif @plugin_arg_str == "DEF_EXC"
      name_array = @celltype.get_name_array cell
        start = @celltype.subst_name("$id$_start", name_array)
        file.print <<EOT
#{tab}DEF_EXC(#{val[:cpuExceptionHandlerNumber]}, { #{val[:attribute]}, #{start} });
EOT
    elsif @plugin_arg_str == "INIT_ROUTINE"
      file.print <<EOT
#{tab}ATT_INI({ #{val[:attribute]}, #{cell_CBP}, tInitializeRoutine_start });
EOT
    elsif @plugin_arg_str == "TERM_ROUTINE"
      file.print <<EOT
#{tab}ATT_TER({ #{val[:attribute]}, #{cell_CBP}, tTerminateRoutine_start });
EOT
    else
      raise "#{@plugin_arg_str} is unknown option"
    end
end


105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/tecsgen/plugin/HRPHandlerPlugin.rb', line 105

def print_cfg_sac(file, val, acv)
  if @plugin_arg_str == "CONFIG_INT"
      # nothing to do
  elsif @plugin_arg_str == "ISR"
      # kernel.cdl の tISR で accessPattern1 ~ accessPattern4 が定義されているときの名残。
      # accessPattern1 が定義されていない場合、こここへは来ない.復活したときに備えて残しておく.
      # file.puts "SAC_#{@plugin_arg_str}(#{val[:id]}, { #{acv[:accessPattern1]}, #{acv[:accessPattern2]}, #{acv[:accessPattern3]}, #{acv[:accessPattern4]} });"
    puts "*** Unsupported *** SAC_#{@plugin_arg_str}(#{val[:id]}, { #{acv[:accessPattern1]}, #{acv[:accessPattern2]}, #{acv[:accessPattern3]}, #{acv[:accessPattern4]} });\n"
  elsif @plugin_arg_str == "DEF_INH"
      # nothing to do
  elsif @plugin_arg_str == "DEF_EXC"
      # nothing to do
  elsif @plugin_arg_str == "INIT_ROUTINE"
      # nothing to do
  elsif @plugin_arg_str == "TERM_ROUTINE"
      # nothing to do
  else
    raise "#{@plugin_arg_str} is unknown option"
  end
end