ecic 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2941906c52685bf8cdd8dd3c988cb33d954917ce1af810b636a6d05a4a7858c9
4
- data.tar.gz: e09506b75b7baaeb904179df7fa2eeb529d71e6084c1d9e150145b40d8ec1f2c
3
+ metadata.gz: 67af83d0923633a5e2f2397d80a6b1d0afbeefeffef35ae45a769372cc86f58a
4
+ data.tar.gz: bbc000b8facc774ccb3ab29f4d43afec136bcff984cc473a91c029535b10cdba
5
5
  SHA512:
6
- metadata.gz: a6cf0330473f92ece3ae09d5448255502e354fce068eba417c9eb8e0c1dc79a1c21791bca6e440cce409f5f58faf2ac9fe1558aa69ba30d4fa742ae4d493487e
7
- data.tar.gz: 7403f3d664272bd3bf5a25a6bbba9c534f212a9425f360f5c3f7531d3787452b7c6c2391e45aff9a908ed417a6ff6492dbe8f3315d1cd75ed66e710a4bc8dfb5
6
+ metadata.gz: 1fa51e7d5d0eca77f46671e5132a4fd2f702d52060b9b4cf297d855e92f1b98c557763901ff77e55aa30b5b7484e3b934579241d1c49374acd20594302b03819
7
+ data.tar.gz: d82d6f3b344dc308528786951e13be92fb2a42cf7431808c81b9f54cfbe9534a447a3c2f3b9d2ed1d5ce33eaed565464f4c25219c16716ad437d225b27777183
@@ -0,0 +1 @@
1
+ pkg/
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ecic (0.1.0)
4
+ ecic (0.2.0)
5
5
  activesupport
6
6
  colorize
7
7
  rake
@@ -10,9 +10,9 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (5.1.4)
13
+ activesupport (5.2.1)
14
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
- i18n (~> 0.7)
15
+ i18n (>= 0.7, < 2)
16
16
  minitest (~> 5.1)
17
17
  tzinfo (~> 1.1)
18
18
  byebug (10.0.0)
@@ -22,11 +22,11 @@ GEM
22
22
  concurrent-ruby (1.0.5)
23
23
  diff-lcs (1.3)
24
24
  docile (1.1.5)
25
- i18n (0.9.4)
25
+ i18n (1.1.0)
26
26
  concurrent-ruby (~> 1.0)
27
27
  json (2.1.0)
28
28
  minitest (5.11.3)
29
- rake (12.3.0)
29
+ rake (12.3.1)
30
30
  rspec (3.7.0)
31
31
  rspec-core (~> 3.7.0)
32
32
  rspec-expectations (~> 3.7.0)
@@ -61,4 +61,4 @@ DEPENDENCIES
61
61
  rspec
62
62
 
63
63
  BUNDLED WITH
64
- 1.16.1
64
+ 1.16.6
@@ -1,15 +1,47 @@
1
1
  help:
2
2
  new:
3
- short: Generate a new project called NAME
3
+ short: Generate a new project in PATH
4
4
  long: |
5
- Creates a new chip project called NAME.
5
+ Creates a new chip project in PATH.
6
6
 
7
7
  Example: ecic new my_project
8
8
 
9
- This creates a new project called 'my_project' in ./my_project
9
+ This creates a new ECIC project in ./my_project
10
+ completion:
11
+ short: Print words for auto-completion
12
+ long: |
13
+ Example:
14
+
15
+ ecic completion
16
+
17
+ Prints words for TAB auto-completion.
18
+
19
+ Examples:
20
+
21
+ ecic completion
22
+ ecic completion generate
23
+ ecic completion generate design
24
+
25
+ To enable TAB auto-completion, add the following to your profile:
26
+
27
+ eval $(ecic completion script)
28
+
29
+ Auto-completion example usage:
30
+
31
+ ecic [TAB]
32
+ ecic generate [TAB]
33
+ ecic generate design [TAB]
34
+ ecic generate design --[TAB]
35
+
36
+ script:
37
+ short: Generate script that can be eval to setup auto-completion
38
+ long: |
39
+ To use, add the following to your ~/.bashrc or ~/.profile
40
+
41
+ eval $(ecic completion script)
42
+
10
43
  generate:
11
44
  short: Generate new testbenches, RTL modules, tests etc.!
12
- generators:
13
45
  testbench:
14
46
  short: Create a new testbench
15
47
  long: |
@@ -23,4 +23,7 @@ module Ecic
23
23
  autoload :Generate, "ecic/generate"
24
24
  autoload :Completion, "ecic/completion"
25
25
  autoload :Completer, "ecic/completer"
26
+ autoload :ProjectGenerator, "ecic/project_generator"
27
+ autoload :LibraryGenerator, "ecic/library_generator"
28
+ autoload :Project, "ecic/project"
26
29
  end
@@ -8,6 +8,11 @@ module Ecic
8
8
  super
9
9
  shell.say "To get more help on a specific command, try 'ecic help [COMMAND]'"
10
10
  end
11
+
12
+ #TBA: Make a function that returns the root folder for the project
13
+ def root
14
+ File.expand_path("./tfj2")
15
+ end
11
16
  end
12
17
 
13
18
  check_unknown_options!
@@ -17,47 +22,57 @@ module Ecic
17
22
  true
18
23
  end
19
24
 
20
- #TBA: Make a function that returns the root folder for the project
21
- def self.root
22
- File.expand_path("./tfj2")
23
- end
24
-
25
- # class_option :verbose, type: :boolean
26
- # class_option :noop, type: :boolean
27
-
28
25
  #--------------------------------------------------------------------------
29
26
  # NEW command:
30
27
  #--------------------------------------------------------------------------
31
- long_desc Help.text(:new)
32
- desc "new PATH", Help.short_text(:new)
28
+ desc "new PATH", Help.text('new')['short']
29
+ long_desc Help.text('new')['long']
33
30
  option :verbose, :type => :boolean
34
31
  def new(path)
35
32
  path = File.expand_path(path)
36
- puts "Generating a new project in #{path}"
33
+ shell.say "Generating a new project in #{path}"
37
34
  generator = ProjectGenerator.new
38
35
  generator.destination_root = path
39
36
  generator.invoke_all
40
- #TBA: invoke installation by eg. calling 'bundler install' from within the generate project folder
37
+
38
+ shell.say "\nTo install the required packages in your project, please run:\n cd #{path}; bundle install\n", Thor::Shell::Color::BOLD
39
+ #TBA: invoke installation by eg. calling 'bundler install' from within the generated project folder
40
+ # Bundler.with_clean_env do
41
+ # Dir.chdir(path) do
42
+ # `bundle install`
43
+ # end
44
+ # end
41
45
  end
42
46
 
43
- desc "generate SUBCOMMAND ...ARGS", "sub subcommands"
44
- long_desc Help.text(:generate)
47
+ #--------------------------------------------------------------------------
48
+ # GENERATE command:
49
+ #--------------------------------------------------------------------------
50
+ desc "generate SUBCOMMAND ...ARGS", Help.text('generate')['short']
51
+ long_desc Help.text('generate')['long']
45
52
  subcommand "generate", Generate
46
53
 
47
- desc "completion *PARAMS", "Print words for auto-completion"
48
- long_desc Help.text("completion")
54
+ #--------------------------------------------------------------------------
55
+ # COMPLETION command:
56
+ #--------------------------------------------------------------------------
57
+ desc "completion *PARAMS", Help.text('completion')['short'], hide: true
58
+ long_desc Help.text('completion')['long']
49
59
  def completion(*params)
50
60
  Completer.new(CLI, *params).run
51
61
  end
52
62
 
53
- desc "completion_script", "Generate script that can be eval to setup auto-completion", hide: true
54
- long_desc Help.text("completion_script")
63
+ #--------------------------------------------------------------------------
64
+ # COMPLETION_SCRIPT command:
65
+ #--------------------------------------------------------------------------
66
+ desc "completion_script", Help.text('completion')['script']['short'], hide: true
67
+ long_desc Help.text('completion')['script']['long']
55
68
  def completion_script
56
69
  Completer::Script.generate
57
70
  end
58
71
 
72
+ #--------------------------------------------------------------------------
73
+ # VERSION command:
74
+ #--------------------------------------------------------------------------
59
75
  desc 'version', 'Display version'
60
- map %w[-v --version] => :version
61
76
  def version
62
77
  say "#{VERSION}"
63
78
  end
@@ -1,13 +1,13 @@
1
1
  module Ecic
2
2
  class Completion < Command
3
3
  desc "script", "generates script that can be eval to setup auto-completion"
4
- long_desc Help.text("completion:script")
4
+ long_desc Help.text('completion')['script']['long']
5
5
  def script
6
6
  Completer::Script.generate
7
7
  end
8
8
 
9
9
  desc "completions *PARAMS", "prints words for auto-completion"
10
- long_desc Help.text("completion:list")
10
+ long_desc Help.text('completion')['list']['long']
11
11
  def list(*params)
12
12
  Completer.new(*params).run
13
13
  end
@@ -4,27 +4,40 @@ module Ecic
4
4
  #--------------------------------------------------------------------------
5
5
  # TESTBENCH generator:
6
6
  #--------------------------------------------------------------------------
7
- class_option :verbose, :type => :boolean
7
+ #### class_option :verbose, :type => :boolean
8
+ #### desc "testbench NAME", Help.text('generate')['testbench']['short']
9
+ #### long_desc Help.text('generate')['testbench']['long']
10
+ #### option :type, :banner => 'vhdl|sv|uvm', :required => true, :desc => 'Speficy the testbench type (VHDL, SystemVerilog or UVM)'
11
+ #### option :just_print, :type => :boolean, :aliases => '-n', :desc => "Don't actually run any commands; just print them."
12
+ #### def testbench(name)
13
+ #### puts "Implement a generator for creating a new testbench"
14
+ #### end
8
15
 
9
- desc "testbench NAME", Help.short_text("generate:testbench")
10
- long_desc Help.text("generate:testbench")
11
- option :type, :banner => 'vhdl|sv|uvm', :required => true, :desc => 'Speficy the testbench type (VHDL, SystemVerilog or UVM)'
12
- option :just_print, :type => :boolean, :aliases => '-n', :desc => "Don't actually run any commands; just print them."
13
- def testbench(name)
14
- puts "Implement a generator for creating a new testbench"
15
- end
16
-
17
- desc "library NAME...", Help.short_text("generate:library")
18
- long_desc Help.text("generate:library")
16
+ #--------------------------------------------------------------------------
17
+ # library generator:
18
+ #--------------------------------------------------------------------------
19
+ desc "library NAME...", Help.text('generate')['library']['short']
20
+ long_desc Help.text('generate')['library']['long']
21
+
19
22
  option :just_print, :type => :boolean, :aliases => '-n', :desc => "Don't actually run any commands; just print them."
20
23
  # def library(names)
21
24
  def library(lib_name)
22
- generator = LibraryGenerator.new
23
- generator.destination_root = Ecic::root
24
- # names.each do |lib_name|
25
- generator.library_name = lib_name
26
- generator.invoke_all
27
- # end
25
+ project_root_path = Ecic::Project::root
26
+ #project_root_path = Dir.pwd
27
+ #if false
28
+ if project_root_path.nil?
29
+ shell.error "You must be within an ECIC project before calling this command"
30
+ exit(1)
31
+ else
32
+ shell.say "Generating a new library in #{project_root_path}"
33
+ generator = LibraryGenerator.new
34
+ generator.destination_root = project_root_path
35
+ # names.each do |lib_name|
36
+ generator.library_name = lib_name
37
+ generator.invoke_all
38
+ # end
39
+ end
40
+
28
41
  end
29
42
  end
30
43
  end
@@ -1,14 +1,14 @@
1
1
  module Ecic::Help
2
+ require 'YAML'
2
3
  class << self
3
4
  def text(namespaced_command)
4
- path = namespaced_command.to_s.gsub(':','/')
5
- path = File.expand_path("../help/#{path}.md", __FILE__)
6
- IO.read(path) if File.exist?(path)
5
+ hlp = YAML.load(File.read(File.expand_path("../../../config/locales/help.en.yaml", __FILE__)))['help'][namespaced_command]
6
+ # hlp['short']
7
7
  end
8
- def short_text(namespaced_command)
9
- path = namespaced_command.to_s.gsub(':','/')
10
- path = File.expand_path("../help/#{path}_short.md", __FILE__)
11
- IO.read(path) if File.exist?(path)
8
+ def long(namespaced_command)
9
+ p namespaced_command
10
+ hlp = YAML.load(File.read(File.expand_path("../../../config/locales/help.en.yaml", __FILE__)))['help'][namespaced_command]
11
+ # hlp['long']
12
12
  end
13
13
  end
14
14
  end
@@ -10,12 +10,11 @@ module Ecic
10
10
  File.dirname(__FILE__) + '/../../templates'
11
11
  end
12
12
 
13
- # def create_library_directory
14
- # copy_file 'projects/src/design/lib/sources.rb', "src/design/#{@library_name}/sources.rb"
15
- # end
13
+ def create_library_directory
14
+ copy_file 'project/src/design/lib/sources.rb', "src/design/#{@library_name}/sources.rb"
15
+ end
16
16
 
17
17
  def update_library_list
18
- #TBA 'src/config' creation is only temporary fix!
19
18
  libraries_file = File.expand_path("#{destination_root}/src/config/libraries.rb")
20
19
  empty_directory 'src/config' unless File.exist?(File.dirname(libraries_file))
21
20
  create_file libraries_file unless File.exist?(libraries_file)
@@ -0,0 +1,20 @@
1
+ module Ecic
2
+
3
+ class Project
4
+
5
+ require 'pathname'
6
+
7
+ SCRIPT_ECIC = File.join('config', 'ecic.rb')
8
+
9
+ #Function that returns the root directory of a ECIC project
10
+ def self.root(path = Pathname.new(Dir.pwd))
11
+ if File.exists?(File.join(path, SCRIPT_ECIC))
12
+ return path
13
+ elsif path.root?
14
+ return nil
15
+ end
16
+ return root(path.parent)
17
+ end
18
+
19
+ end
20
+ end
@@ -12,24 +12,20 @@ module Ecic
12
12
  copy_file 'gitignore', '.gitignore'
13
13
  copy_file 'config/project.rb', 'src/config/project.rb'
14
14
  copy_file 'config/libraries.rb', 'src/config/libraries.rb'
15
- copy_file 'Gemfile', 'Gemfile'
15
+ copy_file 'config/ecic.rb', 'src/config/ecic.rb'
16
+ @ruby_version = '2.4.4'
17
+ template("Gemfile.tt","Gemfile")
16
18
  end
17
19
 
18
20
  def create_output_directories
19
- #TBA: Replace these lines with a call to a TestbenchGenerator class
20
- empty_directory 'src/testbench/chip'
21
- empty_directory 'src/verification/chip'
22
-
23
- copy_file 'src/packages/README.txt', 'src/packages/README.txt'
24
- create_file 'src/design/chip/sources.rb'
21
+ empty_directory 'src/design'
22
+ create_file 'src/design/.gitkeep' if Dir.empty?("#{destination_root}/src/design")
23
+ empty_directory 'src/testbench'
24
+ create_file 'src/testbench/.gitkeep' if Dir.empty?("#{destination_root}/src/testbench")
25
+ empty_directory 'src/verification'
26
+ create_file 'src/verification/.gitkeep' if Dir.empty?("#{destination_root}/src/verification")
25
27
  empty_directory 'src/external_packages'
26
- end
27
-
28
- #Replace this function with a call to a 'VHDLComponentGenerator' class
29
- def create_top_entity
30
- create_file 'src/design/chip/sources.yaml.erb'
31
- create_file 'src/design/chip/chip-rtl_arc.vhd'
32
- create_file 'src/design/chip/chip-ent.vhd'
28
+ create_file 'src/external_packages/.gitkeep' if Dir.empty?("#{destination_root}/src/external_packages")
33
29
  end
34
30
 
35
31
  def git_init
@@ -1,3 +1,3 @@
1
1
  module Ecic
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+ ruby '<%= @ruby_version %>'
3
+ gem 'ecic'
@@ -0,0 +1,13 @@
1
+ Ecic.project.configure do
2
+
3
+ #Select the default type of RTL files you wish to generate:
4
+ #VHDL or SystemVerilog:
5
+ config.generator.library.type.default = 'vhdl'
6
+ # config.generator.library.type.default = 'sv'
7
+
8
+ config.generator.design.vhdl.combine = ''
9
+ # config.generator.design.vhdl.combine = 'entity + architecture'
10
+ # config.generator.design.vhdl.combine = 'entity + component'
11
+ # config.generator.design.vhdl.combine = 'entity + architecture + component'
12
+
13
+ end
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.1.0
4
+ version: 0.2.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-06 00:00:00.000000000 Z
11
+ date: 2018-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -118,6 +118,7 @@ executables:
118
118
  extensions: []
119
119
  extra_rdoc_files: []
120
120
  files:
121
+ - ".gitignore"
121
122
  - CHANGELOG.md
122
123
  - Gemfile
123
124
  - Gemfile.lock
@@ -126,7 +127,6 @@ files:
126
127
  - README.md
127
128
  - Rakefile
128
129
  - bin/console
129
- - bin/ecic
130
130
  - bin/setup
131
131
  - config/ecic.yaml
132
132
  - config/locales/help.en.yaml
@@ -142,26 +142,19 @@ files:
142
142
  - lib/ecic/completion.rb
143
143
  - lib/ecic/generate.rb
144
144
  - lib/ecic/help.rb
145
- - lib/ecic/help/completion.md
146
- - lib/ecic/help/completion_script.md
147
- - lib/ecic/help/generate/library.md
148
- - lib/ecic/help/generate/library_short.md
149
- - lib/ecic/help/generate/testbench.md
150
- - lib/ecic/help/generate/testbench_short.md
151
- - lib/ecic/help/new.md
152
- - lib/ecic/help/new_short.md
153
145
  - lib/ecic/library_generator.rb
146
+ - lib/ecic/project.rb
154
147
  - lib/ecic/project_generator.rb
155
148
  - lib/ecic/version.rb
156
149
  - notes.txt
157
150
  - spec/lib/cli_spec.rb
158
151
  - spec/spec_helper.rb
159
- - templates/project/Gemfile
152
+ - templates/project/Gemfile.tt
153
+ - templates/project/config/ecic.rb
160
154
  - templates/project/config/libraries.rb
161
155
  - templates/project/config/project.rb
162
156
  - templates/project/gitignore
163
157
  - templates/project/src/design/lib/sources.rb
164
- - templates/project/src/packages/README.txt
165
158
  homepage: https://github.com/ic-factory/ecic
166
159
  licenses:
167
160
  - LGPL-3.0
data/bin/ecic DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
4
- require "ecic"
5
-
6
- Ecic::Cli.start(ARGV)
@@ -1,22 +0,0 @@
1
- Example:
2
-
3
- ecic completion
4
-
5
- Prints words for TAB auto-completion.
6
-
7
- Examples:
8
-
9
- ecic completion
10
- ecic completion hello
11
- ecic completion hello name
12
-
13
- To enable TAB auto-completion, add the following to your profile:
14
-
15
- eval $(ecic completion script)
16
-
17
- Auto-completion example usage:
18
-
19
- ecic [TAB]
20
- ecic generate [TAB]
21
- ecic generate design [TAB]
22
- ecic generate design --[TAB]
@@ -1,3 +0,0 @@
1
- To use, add the following to your ~/.bashrc or ~/.profile
2
-
3
- eval $(ecic completion script)
@@ -1,4 +0,0 @@
1
- Examples:
2
-
3
- ecic generate library
4
- ecic generate library NAME
@@ -1 +0,0 @@
1
- Generate new library
@@ -1,4 +0,0 @@
1
- Examples:
2
-
3
- ecic generate testbench
4
- ecic generate testbench NAME
@@ -1 +0,0 @@
1
- Generate new testbench
@@ -1,3 +0,0 @@
1
- Examples:
2
-
3
- ecic new my_project
@@ -1 +0,0 @@
1
- Create new project
@@ -1,3 +0,0 @@
1
- source 'https://rubygems.org'
2
- ruby '2.1.5'
3
- gem 'ecic'
File without changes