Class: Ecic::DesignGenerator

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SourceListUpdater

#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=(value) ⇒ Object (writeonly)

Sets the attribute library

Parameters:

  • value

    the value to set the attribute library to.



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

def library=(value)
  @library = 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
# File 'lib/ecic/design_generator.rb', line 23

def copy_rtl_templates
  base_name = "#{@library.path}/#{@design_name}"
  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



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

def update_src_list
  src_file = File.join(destination_root,"#{@library.path}/sources.rb")  
  create_file src_file unless File.exists?(src_file)
  if @include_types_pkg
    append_to_file(src_file, "source_file('#{@design_name}-pkg_types.vhd')\n")
  end
  append_to_file(src_file, "source_file('#{@design_name}-pkg_comp.vhd')\n")
  append_to_file(src_file, "source_file('#{@design_name}-ent.vhd')\n")
  append_to_file(src_file, "source_file('#{@design_name}-arc_rtl.vhd')\n")
end