Class: Origen::CodeGenerators::Dut

Inherits:
Base
  • Object
show all
Includes:
BlockCommon
Defined in:
lib/origen/code_generators/dut.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BlockCommon

#class_name, #create_files, #extract_model_name, #validate_args_common

Methods inherited from Base

inherited, name, namespace

Methods included from Actions

#add_acronyms, #add_autoload, #add_config, #add_source, #camelcase, #comment_config, #config, #environment, #gem, #gem_group, #generate, #git, #initialize, #lib, #rakefile, #readme, #underscored_app_namespace

Methods included from Actions::Helpers

#add_type_to_namespaces, #class_name_to_blocks_dir, #class_name_to_lib_file, #internal_depth, #resource_path, #resource_path_to_blocks_dir, #resource_path_to_class, #resource_path_to_lib_file, #unless_has_method, #unless_valid_underscored_identifier, #validate_resource_path

Class Method Details



6
7
8
# File 'lib/origen/code_generators/dut.rb', line 6

def self.banner
  'origen new dut NAME'
end

Instance Method Details

#completedObject



52
53
54
55
56
57
58
59
# File 'lib/origen/code_generators/dut.rb', line 52

def completed
  add_acronyms
  puts
  puts 'New DUT created, run the following command to target it in your workspace:'.green
  puts
  puts "  origen t #{@name}"
  puts
end

#create_targetObject



44
45
46
47
48
49
50
# File 'lib/origen/code_generators/dut.rb', line 44

def create_target
  contents = ''
  contents << @final_namespaces.map { |n| camelcase(n) }.join('::')
  contents << "::#{camelcase(@name)}.new\n"

  create_file "#{Origen.root}/target/#{@name}.rb", contents
end

#setupObject



34
35
36
37
38
39
40
41
42
# File 'lib/origen/code_generators/dut.rb', line 34

def setup
  @generate_model = true
  @generate_pins = true
  @generate_timesets = true
  @generate_parameters = true
  @top_level = true
  extract_model_name
  create_files
end

#validate_argsObject



24
25
26
27
28
29
30
31
32
# File 'lib/origen/code_generators/dut.rb', line 24

def validate_args
  if args.size > 1 || args.size == 0
    msg = args.size > 1 ? 'Only one' : 'One'
    msg << " argument is expected by the DUT generator, e.g. 'origen new dut my_soc', 'origen new dut my_family/my_soc"
    puts msg
    exit 1
  end
  validate_args_common
end