Method: SOCMaker::Conf#init_with
- Defined in:
- lib/soc_maker/conf.rb
#init_with(coder) ⇒ Object
Initialization function (from yaml)
coder-
An instance of the Psych::Coder to init this class from a YAML file
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/soc_maker/conf.rb', line 142 def init_with( coder ) init_error_if !( coder.is_a?( Hash ) || coder.is_a?( Psych::Coder ) ), 'coder is not given as Hash neither as Psych::Coder' init_error "No configuration data provided", field: 'data' if coder[ 'data' ] == nil @data = coder[ 'data' ] %w[ vhdl_include build_dir hdl_dir syn_dir sim_dir ].each do |d| raise InitError.new( "Data field '#{d}' is not provided", field: 'data' ) if @data[ d.to_sym ] == nil raise InitError.new( "Data field '#{d}' is not of type String", field: 'data' ) if !@data[ d.to_sym ].is_a?( String ) raise InitError.new( "Data field '#{d}' is not of type String", field: 'data' ) if @data[ d.to_sym ].size == 0 end @data_ro = { # the name of this application/tool :app_name => 'SOC-Maker', # the name of the tool's commandline interface :app_cli_name => 'SOC-Maker CLI', # All classes, which can be loaded by this software :yaml_classes => [ SOCMaker::CoreDef, SOCMaker::SOCDef, SOCMaker::IfcSpc, SOCMaker::LibInc, SOCMaker::Conf, SOCMaker::CoreInst ], # Regular expression, which is evaluatted to detect values like # eval function_name # The function_name is used for further processing :eval_regex => /eval +([a-zA-Z_1-9]+)/, # Regular expression to check, if it is VHDL or verilog :hdl_type_regex => /(\bvhdl\b)|(\bverilog\b)/, # # Regular expression for vhdl file detection # :vhdl_file_regex => /\A\S+\.vhd\Z/, # # Regular expression for verilog file detection # :verilog_file_regex => /\A\S+\.v\Z/, # # Regular expression to match names starting with non-number # :length_regex => /\A[^0-9]+.*\Z/, # # Regular expression to match a component's name (core-name or SOC-name) # (Obsolete) # :name_regex => /^[a-zA-Z]+[a-zA-Z0-9_\-]*$/, :YPP_LUT => { /\bSOCM_CONF\b/ => '--- !ruby/object:SOCMaker::Conf', /\bSOCM_CORE\b/ => '--- !ruby/object:SOCMaker::CoreDef', /\bSOCM_SOC\b/ => '--- !ruby/object:SOCMaker::SOCDef', /\bSOCM_IFC_SPC\b/ => '--- !ruby/object:SOCMaker::IfcSpc', /\bSOCM_INCLUDE\b/ => '--- !ruby/object:SOCMaker::LibInc', /\bSOCM_INST\b/ => '!ruby/object:SOCMaker::CoreInst', /\bSOCM_IFC\b/ => '!ruby/object:SOCMaker::IfcDef', /\bSOCM_PORT\b/ => '!ruby/object:SOCMaker::IfcPort', /\bSOCM_HDL_FILE\b/ => '!ruby/object:SOCMaker::HDLFile', /\bSOCM_PARAM\b/ => '!ruby/object:SOCMaker::Parameter', /\bSOCM_SPARAM\b/ => '!ruby/object:SOCMaker::SParameter', /\bSOCM_SENTRY\b/ => '!ruby/object:SOCMaker::SParameterEntry' }, # # $1 provides the white spaces # $2 the name # :YPP_INV_REGEX => /(\s)*-{0,3}\s*!ruby\/object:SOCMaker::([a-zA-Z]+)/, :YPP_INV_LUT => { 'Conf' => 'SOCM_CONF', 'CoreDef' => 'SOCM_CORE', 'SOCDef' => 'SOCM_SOC', 'CoreInst' => 'SOCM_INST', 'IfcSpc' => 'SOCM_IFC_SPC', 'IfcDef' => 'SOCM_IFC', 'IfcPort' => 'SOCM_PORT', 'HDLFile' => 'SOCM_HDL_FILE', 'Parameter' => 'SOCM_PARAM', 'SParameter' => 'SOCM_SPARAM', 'SParameterEntry' => 'SOCM_SENTRY', 'LibInc' => 'SOCM_INCLUDE' }, # used to split yaml files # :YPP_SPLIT_REGEX => /^\s*---\s*!ruby\/(object|object):SOCMaker/, :COMMENT_REGEX => /([^#]*)(#.*)?/, :EMPTY_CMD_REGEX => /(\s*)(.*)/, :LIC => """ Copyright (C) 2014 Christian Haettich - feddischson [ at ] opencores.org This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. """ } end |