# -*- coding: utf-8 -*- # # TECS Generator # Generator for TOPPERS Embedded Component System # # Copyright (C) 2008-2017 by TOPPERS Project #-- # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ # ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 # 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. # (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 # 権表示,この利用条件および下記の無保証規定が,そのままの形でソー # スコード中に含まれていること. # (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 # 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 # 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 # の無保証規定を掲載すること. # (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 # 用できない形で再配布する場合には,次のいずれかの条件を満たすこ # と. # (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 # 作権表示,この利用条件および下記の無保証規定を掲載すること. # (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに # 報告すること. # (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 # 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. # また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 # 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを # 免責すること. # # 本ソフトウェアは,無保証で提供されているものである.上記著作権者お # よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 # に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ # アの利用により直接的または間接的に生じたいかなる損害に関しても,そ # の責任を負わない. # # $Id$ #++ require_tecsgen_lib 'tecslib/plugin/lib/MrubyBridgeCelltypePluginModule.rb' #== MrubyBridgeCompositePlugin class MrubyBridgeCelltypePlugin < CompositePlugin dbgPrint "MrubyBridgeCelltypePlugin loaded\n" include MrubyBridgeCelltypePluginModule def self.gen_post_code( file ) MrubyBridgeCelltypePluginModule.gen_post_code file end end # ##== celltype プラグインの共通の親クラス #class MrubyBridgeCelltypePlugin < CelltypePlugin # # # プラグイン引数名 => Proc # MrubyBridgePluginArgProc = { # "ignoreUnsigned" => Proc.new { |obj,rhs| obj.set_ignoreUnsigned rhs }, # "include_inner_cell" => Proc.new { |obj,rhs| obj.set_include_inner_cell rhs }, # "exclude_cell" => Proc.new { |obj,rhs| obj.set_exclude_cell rhs }, # "exclude_port" => Proc.new { |obj,rhs| obj.set_exclude_port rhs }, # "exclude_port_func" => Proc.new { |obj,rhs| obj.set_exclude_port_func rhs }, # "auto_exclude" => Proc.new { |obj,rhs| obj.set_auto_exclude rhs }, # } # # require_tecsgen_lib( "MrubyBridgeCellPlugin.rb" ) # @@plugin_list = [] # @@count = 1 # # #celltype:: Celltype セルタイプ(インスタンス) # def initialize( celltype, option ) # dbgPrint "#{self.class.name}: initialzie: #{celltype.get_name}\n" # # super # @celltype = celltype # @cell_list = [] # @include_inner_cell = false # @exclude_cells = [] # @exclude_port = [] # @exclude_port_func = {} # @b_ignoreUnsigned = false # @b_auto_exclude = true # auto_exclude = true by default # @@plugin_list << self # # @plugin_arg_check_proc_tab = MrubyBridgePluginArgProc # @plugin_arg_str = CDLString.remove_dquote option # parse_plugin_arg # # MrubyBridgeCellPlugin.set_gen_post_code_by_dependent # end # # #=== 新しいセル # #cell:: Cell セル # # # # celltype プラグインを指定されたセルタイプのセルが生成された # # セルタイププラグインに対する新しいセルの報告 # # generate 文により呼び出された場合、それまでに定義された cell については、initialize のタイミングで呼び出される # def new_cell( cell ) # dbgPrint "MrubyBridgeCelltypePlugin: new_cell: #{cell.get_name}\n" # # return if @cell_list.include? cell # この行は、本来不要のはず # if TECSGEN.post_coded? # post_code 以降のセルは対象から外す # cdl_info( "I9999 MrubyBridgeCelltypePlugin: $1 is excluded because cell generated after post_coded", cell.get_name ) # return # end # # # include_inner_cell option # if cell.is_cloned? && @include_inner_cell == false then # # p "#{cell.get_name} excluded" # cdl_info( "I9999 MrubyBridgeCelltypePlugin: inner cell $1 is excluded", cell.get_name ) # return # # else # # p "#{cell.get_name} included" # end # # # exclude_cell option # if @exclude_cells.include?( cell.get_name ) then # return # end # # opt_str = "ignoreUnsigned=#{@b_ignoreUnsigned}, auto_exclude=#{@b_auto_exclude}" # @exclude_port.each{ |port| # opt_str += ",exclude_port=#{port}" # } # @exclude_port_func.each{ |port, funcs| # funcs.each{ |func| # opt_str += ",exclude_port_func=#{port}.#{func}" # } # } # # # p "MrubyBridgeCelltypePlugin: opt_str=#{opt_str}" # # # mikan option, region # fn2 = "#{$gen}/tmp_MrubyBridgeCelltypePlugin_#{@celltype.get_name}_#{@@count}.cdl" # f2 = File.open( fn2, "w" ) # f2.print <