Class: HRP2HandlerPlugin

Inherits:
HRP2KernelObjectPlugin show all
Defined in:
lib/tecsgen/plugin/HRP2HandlerPlugin.rb

Overview

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

Constant Summary collapse

@@ep =
[:eStartAlarm, :eStopAlarm, :eManageAlarm, :eReferAlarm]

Constants inherited from Plugin

Plugin::PluginArgProc

Instance Method Summary collapse

Methods inherited from HRP2KernelObjectPlugin

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

Methods inherited from CelltypePlugin

#gen_factory, gen_post_code, #initialize, #new_cell

Methods inherited from Plugin

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

Instance Method Details

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



51
52
53
54
55
56
57
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
# File 'lib/tecsgen/plugin/HRP2HandlerPlugin.rb', line 51

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$  #983
    name_array = @celltype.get_name_array cell
    cell_CBP = name_array[8] # CBP
    # CRE_XXXの生成
    domainOption = cell.get_region.get_domain_root.get_domain_type.get_option
    # if (cell.get_region.get_region_type != :DOMAIN) || (cell.get_region.get_param != :KERNEL_DOMAIN)
    if (domainOption == "OutOfDomain") || (domainOption != "trusted")
        # 無所属 or ユーザドメインに属する場合
      raise "#{@plugin_arg_str.to_s.downcase} handler #{val[:id]} must belong to kernel domain."
    elsif @plugin_arg_str == "ALARM"
      file.print <<EOT
#{tab}CRE_ALM(#{val[:id]}, { #{val[:attribute]}, #{cell_CBP}, tAlarmHandler_start });
EOT
    elsif @plugin_arg_str == "CYCLIC"
      file.print <<EOT
#{tab}CRE_CYC(#{val[:id]}, { #{val[:attribute]}, #{cell_CBP}, tCyclicHandler_start, #{val[:cyclicTime]}, #{val[:cyclicPhase]} });
EOT
    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}ATT_ISR({ #{val[:attribute]}, #{cell_CBP}, #{val[:interruptNumber]}, tISR_start, #{val[:priority]} });
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


93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/tecsgen/plugin/HRP2HandlerPlugin.rb', line 93

def print_cfg_sac(file, val, acv)
  if @plugin_arg_str == "ALARM"
    file.puts "SAC_ALM(#{val[:id]}, { #{acv[0]}, #{acv[1]}, #{acv[2]}, #{acv[3]} });"
  elsif @plugin_arg_str == "CYCLIC"
    file.puts "SAC_CYC(#{val[:id]}, { #{acv[0]}, #{acv[1]}, #{acv[2]}, #{acv[3]} });"
  elsif @plugin_arg_str == "CONFIG_INT"
      # nothing to do
  elsif @plugin_arg_str == "ISR"
      # 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