Class: Ecic::DesignGenerator

Inherits:
Thor::Group
  • Object
show all
Includes:
SourceFileAdder, Thor::Actions
Defined in:
lib/ecic/design_generator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SourceFileAdder

#add_src_file

Instance Attribute Details

#design_name=(value) ⇒ Object (writeonly)

Sets the attribute design_name

Parameters:

  • value

    the value to set the attribute design_name to.



8
9
10
# File 'lib/ecic/design_generator.rb', line 8

def design_name=(value)
  @design_name = value
end

#include_types_pkg=(value) ⇒ Object (writeonly)

Sets the attribute include_types_pkg

Parameters:

  • value

    the value to set the attribute include_types_pkg to.



8
9
10
# File 'lib/ecic/design_generator.rb', line 8

def include_types_pkg=(value)
  @include_types_pkg = value
end

#library_name=(value) ⇒ Object (writeonly)

Sets the attribute library_name

Parameters:

  • value

    the value to set the attribute library_name to.



8
9
10
# File 'lib/ecic/design_generator.rb', line 8

def library_name=(value)
  @library_name = value
end

Class Method Details

.source_rootObject



10
11
12
# File 'lib/ecic/design_generator.rb', line 10

def self.source_root
  File.dirname(__FILE__) + '/../../templates/project'
end

Instance Method Details

#copy_rtl_templatesObject

def create_design_directory

  empty_directory "src/design/#{@library_name}/#{File.dirname(@design_name)}"
end


23
24
25
26
27
28
29
30
31
32
# File 'lib/ecic/design_generator.rb', line 23

def copy_rtl_templates
  base_name = "src/design/#{@library_name}/#{@design_name}"
  @include_types_pkg ||= false
  if @include_types_pkg
    template("src/design/lib/pkg_types.vhd.tt", "#{base_name}-pkg_types.vhd")
  end
  template("src/design/lib/pkg_comp.vhd.tt", "#{base_name}-pkg_comp.vhd")
  template("src/design/lib/ent.vhd.tt", "#{base_name}-ent.vhd")
  template("src/design/lib/arc_rtl.vhd.tt", "#{base_name}-arc_rtl.vhd")
end

#update_src_listObject



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/ecic/design_generator.rb', line 34

def update_src_list
  src_file = "src/design/#{@library_name}/sources.rb"
  create_file src_file unless File.exists?(src_file)
  @include_types_pkg ||= false
  if @include_types_pkg
    add_src_file("#{@design_name}-pkg_types.vhd")
  end
  add_src_file("#{@design_name}-pkg_comp.vhd")
  add_src_file("#{@design_name}-ent.vhd")
  add_src_file("#{@design_name}-arc_rtl.vhd")
end