ecic 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +3 -3
- data/config/locales/help.en.yaml +25 -0
- data/lib/ecic/cli.rb +61 -4
- data/lib/ecic/design_generator.rb +23 -7
- data/lib/ecic/file_adder.rb +21 -0
- data/lib/ecic/generate.rb +52 -26
- data/lib/ecic/helpers/source_file_adder.rb +7 -0
- data/lib/ecic/library.rb +40 -3
- data/lib/ecic/library_generator.rb +3 -3
- data/lib/ecic/project.rb +25 -14
- data/lib/ecic/source_file.rb +20 -0
- data/lib/ecic/sv_design_generator.rb +25 -0
- data/lib/ecic/version.rb +1 -1
- data/lib/ecic.rb +4 -0
- data/notes.txt +5 -3
- data/templates/project/config/libraries.rb +7 -4
- data/templates/project/src/design/lib/arc_rtl.vhd.tt +1 -0
- data/templates/project/src/design/lib/design.sv.tt +1 -0
- data/templates/project/src/design/lib/ent.vhd.tt +1 -0
- data/templates/project/src/design/lib/pkg_comp.vhd.tt +1 -0
- data/templates/project/src/design/lib/pkg_types.vhd.tt +1 -0
- data/templates/project/src/design/lib/sources.rb.tt +7 -0
- metadata +8 -3
- data/templates/project/src/design/lib/sources.rb +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5fe4c1aca4adfa0193f736c1ad55a32addf62978adf94d658b677805fa5efe2a
|
|
4
|
+
data.tar.gz: 7f01b0281fda482bb7007e8fbdcd592cb03cefb1c198dae0687f4ddb61b98956
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9791e87cbb17451e0c5b45802a958b7ac0c4e06ce4eea40b9c6fdc850486b5c1310543afbc1ff31fba98e539bf5e09e073ed9aa40b0a054d48dd68cccf655b6f
|
|
7
|
+
data.tar.gz: 98bc6a7a59f5ab7267095dd6681eb240ccf5672ddf883ea0b23d331fe43945ce648c619dcce2d80c622957c0937cf0603729887a24c5b951fe660413e2001f90
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -95,7 +95,7 @@ Should you still wish to combine eg. the entity and architecture files into one
|
|
|
95
95
|
|
|
96
96
|
This would result in a file with a `-ent-arc_rtl.vhd` extention for the file containing both the entity and architecture.
|
|
97
97
|
|
|
98
|
-
##### Create multiple VHDL
|
|
98
|
+
##### Create multiple VHDL designs for the same library
|
|
99
99
|
|
|
100
100
|
You can create multiple designs at the same time, and designs can be placed in subfolders within a library. For example, to create a new VHDL design called `my_design2` at the root of a library called `my_lib` and create another VHDL design called `my_design3` in a subfolder called `my_subblock`, run:
|
|
101
101
|
|
|
@@ -144,7 +144,7 @@ That will generate the files as:
|
|
|
144
144
|
|
|
145
145
|
./src/design/queue_system/statemachine-*.vhd #Path is relative to the project root folder
|
|
146
146
|
|
|
147
|
-
Note
|
|
147
|
+
**Note:** Even though the current working directory in this example is `arbitor`, the generated files will be placed in the `queue_system` folder, since no hierarchy is included in the design name.
|
|
148
148
|
|
|
149
149
|
## Migrating an existing project to use ECIC
|
|
150
150
|
|
|
@@ -203,6 +203,6 @@ To install the ECIC framework onto your local machine, run `bundle exec rake ins
|
|
|
203
203
|
4. Push to the branch (`git push origin my-new-feature`)
|
|
204
204
|
5. Create new Pull Request
|
|
205
205
|
|
|
206
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/ic-factory/ecic.
|
|
206
|
+
Bug reports and pull requests are most welcome on GitHub at https://github.com/ic-factory/ecic.
|
|
207
207
|
|
|
208
208
|
|
data/config/locales/help.en.yaml
CHANGED
|
@@ -7,6 +7,16 @@ help:
|
|
|
7
7
|
Example: ecic new my_project
|
|
8
8
|
|
|
9
9
|
This creates a new ECIC project in ./my_project
|
|
10
|
+
libraries:
|
|
11
|
+
short: Display list of libraries in the project
|
|
12
|
+
long: |
|
|
13
|
+
Displays a list of the libraries in the project, optionally
|
|
14
|
+
along with a list of source files for each library.
|
|
15
|
+
|
|
16
|
+
Example: ecic libraries --include-source-files --format=json
|
|
17
|
+
|
|
18
|
+
Prints a JSON formatted list of all libraries, including the source files in each library.
|
|
19
|
+
|
|
10
20
|
completion:
|
|
11
21
|
short: Print words for auto-completion
|
|
12
22
|
long: |
|
|
@@ -40,8 +50,23 @@ help:
|
|
|
40
50
|
|
|
41
51
|
eval $(ecic completion script)
|
|
42
52
|
|
|
53
|
+
addfile:
|
|
54
|
+
short: Add existing design and testbench files to the project!
|
|
55
|
+
long: |
|
|
56
|
+
Add one or more existing design files to a given library in the project!
|
|
57
|
+
|
|
58
|
+
Example: ecic addfile my_lib ./foo/bar/some_design.sv ../toto/kuku.vhd
|
|
59
|
+
|
|
60
|
+
This adds the ./foo/bar/some_design.sv ../toto/kuku.vhd files to the library
|
|
61
|
+
called 'my_lib' by adding these to the <PROJECT_ROOT>/src/design/my_lib/sources.rb file.
|
|
62
|
+
|
|
63
|
+
Although all files that belong to a given library should be placed in the
|
|
64
|
+
folder for that library, you can specify files that are placed anywhere
|
|
65
|
+
in your file system.
|
|
66
|
+
|
|
43
67
|
generate:
|
|
44
68
|
short: Generate new testbenches, RTL modules, tests etc.!
|
|
69
|
+
|
|
45
70
|
testbench:
|
|
46
71
|
short: Create a new testbench
|
|
47
72
|
long: |
|
data/lib/ecic/cli.rb
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
module Ecic
|
|
2
2
|
class CLI < Command
|
|
3
|
+
|
|
4
|
+
include Ecic::SourceFileAdder
|
|
3
5
|
|
|
4
6
|
class << self
|
|
5
7
|
def help(shell, subcommand = false)
|
|
@@ -48,9 +50,49 @@ module Ecic
|
|
|
48
50
|
# GENERATE command:
|
|
49
51
|
#--------------------------------------------------------------------------
|
|
50
52
|
desc "generate SUBCOMMAND ...ARGS", Help.text('generate')['short']
|
|
51
|
-
long_desc Help.text('generate')['long']
|
|
52
53
|
subcommand "generate", Generate
|
|
53
54
|
|
|
55
|
+
|
|
56
|
+
#--------------------------------------------------------------------------
|
|
57
|
+
# design generator:
|
|
58
|
+
#--------------------------------------------------------------------------
|
|
59
|
+
desc "addfile LIBRARY_NAME FILENAME...", Help.text('addfile')['short']
|
|
60
|
+
long_desc Help.text('addfile')['long']
|
|
61
|
+
|
|
62
|
+
def addfile(lib_name, *file_names)
|
|
63
|
+
begin
|
|
64
|
+
root_dir = Project::root
|
|
65
|
+
if root_dir.nil?
|
|
66
|
+
shell.error "You must be within an ECIC project before calling this command"
|
|
67
|
+
exit(1)
|
|
68
|
+
end
|
|
69
|
+
project = Project.new(root_dir)
|
|
70
|
+
project.load_libraries
|
|
71
|
+
|
|
72
|
+
unless project.has_library?(lib_name)
|
|
73
|
+
if yes?("Library '#{lib_name}' does not exist. Create it? [y/n]:")
|
|
74
|
+
generator = LibraryGenerator.new
|
|
75
|
+
generator.destination_root = root_dir
|
|
76
|
+
generator.library_name = lib_name
|
|
77
|
+
generator.invoke_all
|
|
78
|
+
else
|
|
79
|
+
shell.error "Operation aborted!"
|
|
80
|
+
exit(2)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
file_adder = FileAdder.new
|
|
84
|
+
file_adder.library_name = lib_name
|
|
85
|
+
file_adder.file_names = file_names
|
|
86
|
+
file_adder.invoke_all
|
|
87
|
+
|
|
88
|
+
rescue Exception => exc
|
|
89
|
+
shell.error exc.message
|
|
90
|
+
exit(3)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
|
|
54
96
|
#--------------------------------------------------------------------------
|
|
55
97
|
# COMPLETION command:
|
|
56
98
|
#--------------------------------------------------------------------------
|
|
@@ -80,8 +122,18 @@ module Ecic
|
|
|
80
122
|
#--------------------------------------------------------------------------
|
|
81
123
|
# LIBRARIES command:
|
|
82
124
|
#--------------------------------------------------------------------------
|
|
83
|
-
desc 'libraries', '
|
|
125
|
+
desc 'libraries', Help.text('libraries')['short']
|
|
126
|
+
long_desc Help.text('libraries')['long']
|
|
127
|
+
option :format, :type => :string, :banner => 'text|json', :desc => 'Specify the output format'
|
|
128
|
+
option :include_source_files, :type => :boolean, :aliases => '-s', :desc => "Include source files for each library"
|
|
84
129
|
def libraries
|
|
130
|
+
|
|
131
|
+
defaults = {
|
|
132
|
+
"format" => "text",
|
|
133
|
+
"include_source_files" => false
|
|
134
|
+
}
|
|
135
|
+
opt = defaults.merge(options)
|
|
136
|
+
|
|
85
137
|
root_dir = Project::root
|
|
86
138
|
if root_dir.nil?
|
|
87
139
|
shell.error "You must be within an ECIC project before calling this command"
|
|
@@ -89,9 +141,14 @@ module Ecic
|
|
|
89
141
|
end
|
|
90
142
|
project = Project.new(root_dir)
|
|
91
143
|
project.load_libraries
|
|
92
|
-
|
|
144
|
+
project.load_sources if opt['include_source_files']
|
|
145
|
+
if opt['format'] == 'json'
|
|
146
|
+
require 'json'
|
|
147
|
+
say project.libraries.map{ |lib| lib.to_json(:include_source_files => opt['include_source_files']) }.join(",")
|
|
148
|
+
else
|
|
149
|
+
say project.libraries.map{ |lib| lib.to_str(:include_source_files => opt['include_source_files']) }.join("\n")
|
|
150
|
+
end
|
|
93
151
|
end
|
|
94
|
-
|
|
95
152
|
end
|
|
96
153
|
end
|
|
97
154
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
module Ecic
|
|
2
2
|
|
|
3
3
|
class DesignGenerator < Thor::Group
|
|
4
|
+
# require source_file_adder
|
|
4
5
|
include Thor::Actions
|
|
5
|
-
|
|
6
|
+
include Ecic::SourceFileAdder
|
|
6
7
|
|
|
7
|
-
attr_writer :library_name, :design_name
|
|
8
|
+
attr_writer :library_name, :design_name, :include_types_pkg
|
|
8
9
|
|
|
9
10
|
def self.source_root
|
|
10
11
|
File.dirname(__FILE__) + '/../../templates/project'
|
|
11
12
|
end
|
|
12
13
|
|
|
13
|
-
|
|
14
14
|
# def initialize(project_root_path, lib_name)
|
|
15
15
|
# @destination_root = project_root_path
|
|
16
16
|
# @library_name = lib_name
|
|
@@ -20,11 +20,27 @@ module Ecic
|
|
|
20
20
|
# empty_directory "src/design/#{@library_name}/#{File.dirname(@design_name)}"
|
|
21
21
|
# end
|
|
22
22
|
|
|
23
|
+
def copy_rtl_templates
|
|
24
|
+
base_name = "src/design/#{@library_name}/#{@design_name}"
|
|
25
|
+
@include_types_pkg ||= false
|
|
26
|
+
if @include_types_pkg
|
|
27
|
+
template("src/design/lib/pkg_types.vhd.tt", "#{base_name}-pkg_types.vhd")
|
|
28
|
+
end
|
|
29
|
+
template("src/design/lib/pkg_comp.vhd.tt", "#{base_name}-pkg_comp.vhd")
|
|
30
|
+
template("src/design/lib/ent.vhd.tt", "#{base_name}-ent.vhd")
|
|
31
|
+
template("src/design/lib/arc_rtl.vhd.tt", "#{base_name}-arc_rtl.vhd")
|
|
32
|
+
end
|
|
33
|
+
|
|
23
34
|
def update_src_list
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
src_file = "src/design/#{@library_name}/sources.rb"
|
|
36
|
+
create_file src_file unless File.exists?(src_file)
|
|
37
|
+
@include_types_pkg ||= false
|
|
38
|
+
if @include_types_pkg
|
|
39
|
+
add_src_file("#{@design_name}-pkg_types.vhd")
|
|
40
|
+
end
|
|
41
|
+
add_src_file("#{@design_name}-pkg_comp.vhd")
|
|
42
|
+
add_src_file("#{@design_name}-ent.vhd")
|
|
43
|
+
add_src_file("#{@design_name}-arc_rtl.vhd")
|
|
28
44
|
end
|
|
29
45
|
|
|
30
46
|
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Ecic
|
|
2
|
+
|
|
3
|
+
class FileAdder < Thor::Group
|
|
4
|
+
include Thor::Actions
|
|
5
|
+
include Ecic::SourceFileAdder
|
|
6
|
+
|
|
7
|
+
attr_writer :library_name, :file_names
|
|
8
|
+
|
|
9
|
+
# def self.source_root
|
|
10
|
+
# File.dirname(__FILE__) + '/../../templates/project'
|
|
11
|
+
# end
|
|
12
|
+
|
|
13
|
+
def add_files_to_source_list
|
|
14
|
+
@file_names.each { |file_name|
|
|
15
|
+
add_src_file(file_name)
|
|
16
|
+
}
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
data/lib/ecic/generate.rb
CHANGED
|
@@ -47,38 +47,64 @@ module Ecic
|
|
|
47
47
|
option :just_print, :type => :boolean, :aliases => '-n', :desc => "Don't actually run any commands; just print them."
|
|
48
48
|
option :type, :type => :string, :banner => 'vhdl|sv', :required => true, :desc => 'Speficy the RTL type (VHDL or Verilog/SystemVerilog)'
|
|
49
49
|
option :lib, :type => :string, :banner => 'LIBRARY_NAME', :required => true, :desc => 'Speficy the RTL type (VHDL or Verilog/SystemVerilog)'
|
|
50
|
+
option :types_package, :type => :boolean, :desc => "Include a package file for type and constant definitions."
|
|
51
|
+
|
|
50
52
|
def design(*names)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
begin
|
|
54
|
+
lib_name = options[:lib]
|
|
55
|
+
type = options[:type]
|
|
56
|
+
root_dir = Project::root
|
|
57
|
+
if root_dir.nil?
|
|
58
|
+
shell.error "You must be within an ECIC project before calling this command"
|
|
59
|
+
exit(1)
|
|
60
|
+
end
|
|
61
|
+
project = Project.new(root_dir)
|
|
62
|
+
project.load_libraries
|
|
63
|
+
# p project.libraries
|
|
61
64
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
unless project.has_library?(lib_name)
|
|
66
|
+
if yes?("Library '#{lib_name}' does not exist. Create it? [y/n]:")
|
|
67
|
+
generator = LibraryGenerator.new
|
|
68
|
+
generator.destination_root = root_dir
|
|
69
|
+
generator.library_name = lib_name
|
|
70
|
+
generator.invoke_all
|
|
71
|
+
else
|
|
72
|
+
shell.error "Operation aborted!"
|
|
73
|
+
exit(2)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
names.each { |design_name|
|
|
78
|
+
incl_types_pkg = options[:types_package]
|
|
79
|
+
if type == 'vhdl'
|
|
80
|
+
incl_types_pkg = yes?("Would you like to include a package for type and constant definitions for '#{design_name}'? [y/n]: ") if incl_types_pkg.nil?
|
|
81
|
+
else
|
|
82
|
+
incl_types_pkg ||= false
|
|
83
|
+
if incl_types_pkg
|
|
84
|
+
shell.error "--types_package option does not apply for Verilog/SystemVerilog generation!"
|
|
85
|
+
exit(3)
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
#Tba
|
|
89
|
+
if type == 'vhdl'
|
|
90
|
+
generator = DesignGenerator.new
|
|
91
|
+
generator.include_types_pkg = incl_types_pkg
|
|
92
|
+
elsif type == 'sv'
|
|
93
|
+
generator = SvDesignGenerator.new
|
|
94
|
+
else
|
|
95
|
+
shell.error "--type option must be set to either 'vhdl' or 'sv'"
|
|
96
|
+
exit(3)
|
|
97
|
+
end
|
|
65
98
|
generator.destination_root = root_dir
|
|
66
99
|
generator.library_name = lib_name
|
|
100
|
+
generator.design_name = design_name
|
|
67
101
|
generator.invoke_all
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
102
|
+
}
|
|
103
|
+
rescue Exception => exc
|
|
104
|
+
shell.error exc.message
|
|
105
|
+
exit(3)
|
|
72
106
|
end
|
|
73
|
-
|
|
74
|
-
# shell.say "Generating '#{design_name}' design in #{lib_name} ..."
|
|
75
|
-
generator = DesignGenerator.new
|
|
76
|
-
# shell.error "DesignGenerator could not be created" if generator.nil?
|
|
77
|
-
generator.destination_root = root_dir
|
|
78
|
-
generator.library_name = lib_name
|
|
79
|
-
generator.design_name = design_name
|
|
80
|
-
generator.invoke_all
|
|
81
|
-
}
|
|
107
|
+
|
|
82
108
|
end
|
|
83
109
|
end
|
|
84
110
|
end
|
data/lib/ecic/library.rb
CHANGED
|
@@ -3,17 +3,54 @@ module Ecic
|
|
|
3
3
|
class Library
|
|
4
4
|
|
|
5
5
|
attr_accessor :name
|
|
6
|
+
attr_accessor :source_files
|
|
6
7
|
|
|
7
|
-
def initialize(name=nil)
|
|
8
|
+
def initialize(project, name=nil)
|
|
9
|
+
@project = project
|
|
8
10
|
@name = name
|
|
11
|
+
@source_files = []
|
|
9
12
|
end
|
|
10
13
|
|
|
11
14
|
def create(name)
|
|
12
15
|
@name = name
|
|
13
16
|
end
|
|
14
17
|
|
|
15
|
-
def
|
|
16
|
-
|
|
18
|
+
def to_str(options={})
|
|
19
|
+
str = name
|
|
20
|
+
incl_src_files = options[:include_source_files] || false
|
|
21
|
+
if incl_src_files
|
|
22
|
+
str += "\n" + source_files.join("\n")
|
|
23
|
+
end
|
|
24
|
+
str
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def to_json(options = {})
|
|
28
|
+
incl_src_files = options[:include_source_files] || false
|
|
29
|
+
if incl_src_files
|
|
30
|
+
str = {:name => name, :source_files => source_files}.to_json
|
|
31
|
+
else
|
|
32
|
+
str = {:name => name}.to_json
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def load_sources
|
|
37
|
+
src_file = File.join(@project.root, 'src', 'design', @name, 'sources.rb')
|
|
38
|
+
if File.exists?(src_file)
|
|
39
|
+
begin
|
|
40
|
+
eval File.read(src_file)
|
|
41
|
+
rescue Exception => exc
|
|
42
|
+
raise "Syntax error occurred while reading #{src_file}: #{exc.message}"
|
|
43
|
+
end
|
|
44
|
+
else
|
|
45
|
+
raise "Could not read sources for #{name} library"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
#Function used by 'source.create' method used in src/confic/libraries.rb
|
|
50
|
+
def source_file
|
|
51
|
+
new_src = SourceFile.new(self)
|
|
52
|
+
source_files << new_src
|
|
53
|
+
new_src
|
|
17
54
|
end
|
|
18
55
|
|
|
19
56
|
end
|
|
@@ -7,18 +7,18 @@ module Ecic
|
|
|
7
7
|
attr_writer :library_name
|
|
8
8
|
|
|
9
9
|
def self.source_root
|
|
10
|
-
File.dirname(__FILE__) + '/../../templates'
|
|
10
|
+
File.dirname(__FILE__) + '/../../templates/project'
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def create_library_directory
|
|
14
|
-
|
|
14
|
+
template("src/design/lib/sources.rb.tt", "src/design/#{@library_name}/sources.rb")
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def update_library_list
|
|
18
18
|
libraries_file = File.expand_path("#{destination_root}/src/config/libraries.rb")
|
|
19
19
|
empty_directory 'src/config' unless File.exist?(File.dirname(libraries_file))
|
|
20
20
|
create_file libraries_file unless File.exist?(libraries_file)
|
|
21
|
-
append_to_file 'src/config/libraries.rb', "
|
|
21
|
+
append_to_file 'src/config/libraries.rb', "library.create('#{@library_name}')\n"
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
end
|
data/lib/ecic/project.rb
CHANGED
|
@@ -3,6 +3,7 @@ module Ecic
|
|
|
3
3
|
class Project
|
|
4
4
|
|
|
5
5
|
attr_accessor :libraries
|
|
6
|
+
attr_reader :root
|
|
6
7
|
|
|
7
8
|
require 'pathname'
|
|
8
9
|
|
|
@@ -15,6 +16,8 @@ module Ecic
|
|
|
15
16
|
LIBRARIES_CFG_SCRIPT = File.join('src', 'config', 'libraries.rb')
|
|
16
17
|
|
|
17
18
|
#Function that returns the root directory of a ECIC project
|
|
19
|
+
#This is used by some generators to check if a command is called
|
|
20
|
+
#from within an ECIC project folder
|
|
18
21
|
def self.root(path = Pathname.new(Dir.pwd))
|
|
19
22
|
if File.exists?(File.join(path, SCRIPT_ECIC))
|
|
20
23
|
return path
|
|
@@ -23,31 +26,39 @@ module Ecic
|
|
|
23
26
|
end
|
|
24
27
|
return root(path.parent)
|
|
25
28
|
end
|
|
26
|
-
|
|
27
|
-
def default_library_cfg_file
|
|
28
|
-
File.join(@root, LIBRARIES_CFG_SCRIPT)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
29
|
|
|
32
|
-
def load_libraries
|
|
30
|
+
def load_libraries
|
|
31
|
+
lib_file = File.join(@root, LIBRARIES_CFG_SCRIPT)
|
|
33
32
|
if File.exists?(lib_file)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
begin
|
|
34
|
+
eval File.read(lib_file)
|
|
35
|
+
rescue Exception => exc
|
|
36
|
+
raise "Syntax error occurred while reading #{lib_file}: #{exc.message}"
|
|
37
|
+
end
|
|
38
|
+
# else
|
|
39
|
+
# raise "Could not read library definitions from #{lib_file}"
|
|
38
40
|
end
|
|
39
|
-
|
|
40
41
|
end
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
|
|
44
|
+
def has_library?(lib_name)
|
|
45
|
+
libraries.any? {|l| l.name == lib_name }
|
|
44
46
|
end
|
|
45
47
|
|
|
48
|
+
# def add_libray(name)
|
|
49
|
+
# @libraries << Library.new(self, name)
|
|
50
|
+
# end
|
|
51
|
+
|
|
52
|
+
#Function used by 'library.create' method used in src/confic/libraries.rb
|
|
46
53
|
def library
|
|
47
|
-
new_lib = Library.new()
|
|
54
|
+
new_lib = Library.new(self)
|
|
48
55
|
libraries << new_lib
|
|
49
56
|
new_lib
|
|
50
57
|
end
|
|
51
58
|
|
|
59
|
+
def load_sources
|
|
60
|
+
libraries.each { |lib| lib.load_sources }
|
|
61
|
+
end
|
|
62
|
+
|
|
52
63
|
end
|
|
53
64
|
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Ecic
|
|
2
|
+
|
|
3
|
+
class SvDesignGenerator < Thor::Group
|
|
4
|
+
include Thor::Actions
|
|
5
|
+
desc 'Generate a new SystemVerilog design'
|
|
6
|
+
|
|
7
|
+
attr_writer :library_name, :design_name
|
|
8
|
+
|
|
9
|
+
def self.source_root
|
|
10
|
+
File.dirname(__FILE__) + '/../../templates/project'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def copy_rtl_templates
|
|
14
|
+
base_name = "src/design/#{@library_name}/#{@design_name}"
|
|
15
|
+
template("src/design/lib/design.sv.tt", "#{base_name}.sv")
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def update_src_list
|
|
19
|
+
src_file = "src/design/#{@library_name}/sources.rb"
|
|
20
|
+
create_file src_file unless File.exists?(src_file)
|
|
21
|
+
append_to_file src_file, "source_file.create('#{@design_name}.sv')\n"
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
end
|
data/lib/ecic/version.rb
CHANGED
data/lib/ecic.rb
CHANGED
|
@@ -21,11 +21,15 @@ module Ecic
|
|
|
21
21
|
autoload :Command, "ecic/command"
|
|
22
22
|
autoload :CLI, "ecic/cli"
|
|
23
23
|
autoload :Generate, "ecic/generate"
|
|
24
|
+
autoload :FileAdder, "ecic/file_adder"
|
|
24
25
|
autoload :Completion, "ecic/completion"
|
|
25
26
|
autoload :Completer, "ecic/completer"
|
|
26
27
|
autoload :DesignGenerator, "ecic/design_generator"
|
|
28
|
+
autoload :SvDesignGenerator, "ecic/sv_design_generator"
|
|
27
29
|
autoload :ProjectGenerator, "ecic/project_generator"
|
|
28
30
|
autoload :LibraryGenerator, "ecic/library_generator"
|
|
31
|
+
autoload :SourceFileAdder, "ecic/helpers/source_file_adder"
|
|
32
|
+
autoload :SourceFile, "ecic/source_file"
|
|
29
33
|
autoload :Library, "ecic/library"
|
|
30
34
|
autoload :Project, "ecic/project"
|
|
31
35
|
end
|
data/notes.txt
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
* Remove any '/' prefix and postfix from library names when generating a new library (to allow use of "find" command to generate a number of libraries)
|
|
2
|
+
* 'addfile' command must check that each add file actually exists.
|
|
3
|
+
|
|
1
4
|
#Syntax for sources.rb
|
|
2
5
|
|
|
3
6
|
add design chip, :env => ['asic_rtl', 'asic_gate', 'fpga_rtl']
|
|
4
7
|
add design [basic_vhdl, chip], :except => {:env => ['asic']}
|
|
5
8
|
#add design chip_tb, :path => '/some/absolute/path'
|
|
6
9
|
#add testbench chip_tb, :path => '/some/absolute/path'
|
|
7
|
-
|
|
10
|
+
|
|
11
|
+
#Libraries can be added in libraries.rb with the syntax:
|
|
8
12
|
library.create('lib_x')
|
|
9
|
-
and
|
|
10
|
-
libraries << Library.new('lib_z')
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
#This file lists all libraries in the project.
|
|
2
2
|
|
|
3
3
|
#Syntax:
|
|
4
|
-
#
|
|
4
|
+
#
|
|
5
|
+
# library.create('LIBRARY')
|
|
6
|
+
#
|
|
5
7
|
# where LIBRARY is the name of a VHDL/Verilog library that must be placed in a folder of the same name under src/design
|
|
6
8
|
|
|
7
9
|
#Syntax:
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
|
|
10
|
+
#
|
|
11
|
+
# testbench.create('TESTBENCH')
|
|
12
|
+
#
|
|
13
|
+
# where TESTBENCH is the name of a testbench that must be placed in a folder of the same name under src/testbench
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VHDL architecture template file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
SystemVerilog template file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VHDL entity template file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VHDL component template file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VHDL types package template file
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ecic
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Torben Fox Jacobsen
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-10-
|
|
11
|
+
date: 2018-10-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: thor
|
|
@@ -141,12 +141,16 @@ files:
|
|
|
141
141
|
- lib/ecic/completer/script.sh
|
|
142
142
|
- lib/ecic/completion.rb
|
|
143
143
|
- lib/ecic/design_generator.rb
|
|
144
|
+
- lib/ecic/file_adder.rb
|
|
144
145
|
- lib/ecic/generate.rb
|
|
145
146
|
- lib/ecic/help.rb
|
|
147
|
+
- lib/ecic/helpers/source_file_adder.rb
|
|
146
148
|
- lib/ecic/library.rb
|
|
147
149
|
- lib/ecic/library_generator.rb
|
|
148
150
|
- lib/ecic/project.rb
|
|
149
151
|
- lib/ecic/project_generator.rb
|
|
152
|
+
- lib/ecic/source_file.rb
|
|
153
|
+
- lib/ecic/sv_design_generator.rb
|
|
150
154
|
- lib/ecic/version.rb
|
|
151
155
|
- notes.txt
|
|
152
156
|
- spec/lib/cli_spec.rb
|
|
@@ -157,10 +161,11 @@ files:
|
|
|
157
161
|
- templates/project/config/project.rb
|
|
158
162
|
- templates/project/gitignore
|
|
159
163
|
- templates/project/src/design/lib/arc_rtl.vhd.tt
|
|
164
|
+
- templates/project/src/design/lib/design.sv.tt
|
|
160
165
|
- templates/project/src/design/lib/ent.vhd.tt
|
|
161
166
|
- templates/project/src/design/lib/pkg_comp.vhd.tt
|
|
162
167
|
- templates/project/src/design/lib/pkg_types.vhd.tt
|
|
163
|
-
- templates/project/src/design/lib/sources.rb
|
|
168
|
+
- templates/project/src/design/lib/sources.rb.tt
|
|
164
169
|
homepage: https://github.com/ic-factory/ecic
|
|
165
170
|
licenses:
|
|
166
171
|
- LGPL-3.0
|
|
File without changes
|