basechip 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/.document +5 -0
  2. data/Gemfile +20 -0
  3. data/Gemfile.lock +32 -0
  4. data/LICENSE.txt +14 -0
  5. data/README.rdoc +19 -0
  6. data/VERSION +1 -0
  7. data/bin/basechip +25 -0
  8. data/collateral/block/block.rb.erb +20 -0
  9. data/collateral/configuration/configuration.rb.erb +19 -0
  10. data/collateral/project/Gemfile +19 -0
  11. data/collateral/project/gitignore +6 -0
  12. data/collateral/project/project.rb.erb +76 -0
  13. data/collateral/project/settings.rb.erb +26 -0
  14. data/collateral/recipes/icarus.rb +73 -0
  15. data/collateral/recipes/icarus.rb.erb +88 -0
  16. data/collateral/recipes/local_cluster.rb +27 -0
  17. data/lib/array.rb +26 -0
  18. data/lib/base_chip/action.rb +309 -0
  19. data/lib/base_chip/base.rb +105 -0
  20. data/lib/base_chip/block.rb +75 -0
  21. data/lib/base_chip/bom.rb +75 -0
  22. data/lib/base_chip/bom_file.rb +45 -0
  23. data/lib/base_chip/cli.rb +371 -0
  24. data/lib/base_chip/cluster.rb +93 -0
  25. data/lib/base_chip/cluster_type.rb +45 -0
  26. data/lib/base_chip/code_area.rb +30 -0
  27. data/lib/base_chip/configuration.rb +257 -0
  28. data/lib/base_chip/dsl.rb +593 -0
  29. data/lib/base_chip/exit_error.rb +20 -0
  30. data/lib/base_chip/generator_menu.rb +64 -0
  31. data/lib/base_chip/git.rb +32 -0
  32. data/lib/base_chip/hierarchy.rb +84 -0
  33. data/lib/base_chip/install_menu.rb +89 -0
  34. data/lib/base_chip/ipc.rb +50 -0
  35. data/lib/base_chip/list_menu.rb +134 -0
  36. data/lib/base_chip/menu.rb +70 -0
  37. data/lib/base_chip/out_file.rb +68 -0
  38. data/lib/base_chip/permutation.rb +26 -0
  39. data/lib/base_chip/permute.rb +25 -0
  40. data/lib/base_chip/post.rb +26 -0
  41. data/lib/base_chip/problem.rb +33 -0
  42. data/lib/base_chip/project.rb +472 -0
  43. data/lib/base_chip/requirement.rb +26 -0
  44. data/lib/base_chip/runable.rb +36 -0
  45. data/lib/base_chip/source_language.rb +40 -0
  46. data/lib/base_chip/source_type.rb +24 -0
  47. data/lib/base_chip/statistic.rb +27 -0
  48. data/lib/base_chip/task.rb +21 -0
  49. data/lib/base_chip/task_master.rb +50 -0
  50. data/lib/base_chip/taskable.rb +77 -0
  51. data/lib/base_chip/tasker.rb +260 -0
  52. data/lib/base_chip/test.rb +202 -0
  53. data/lib/base_chip/test_list.rb +120 -0
  54. data/lib/base_chip/tool.rb +51 -0
  55. data/lib/base_chip/tool_version.rb +34 -0
  56. data/lib/base_chip/top_menu.rb +203 -0
  57. data/lib/base_chip/track_state.rb +61 -0
  58. data/lib/base_chip.rb +215 -0
  59. data/lib/dir.rb +30 -0
  60. data/lib/reporting.rb +97 -0
  61. metadata +215 -0
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ gem 'archive-tar-minitar'
7
+ gem 'activesupport'
8
+ gem 'i18n'
9
+ gem 'thor'
10
+
11
+ # Add dependencies to develop your gem here.
12
+ # Include everything needed to run rake, tests, features, etc.
13
+ group :development do
14
+ #gem "shoulda", ">= 0"
15
+ gem "yard"
16
+ gem "bundler", "~> 1.0.0"
17
+ gem "jeweler", "~> 1.6.4"
18
+ gem "rcov", ">= 0"
19
+ gem "turn", :require=>false
20
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,32 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (3.0.0)
5
+ ansi (1.3.0)
6
+ archive-tar-minitar (0.5.2)
7
+ git (1.2.5)
8
+ i18n (0.5.0)
9
+ jeweler (1.6.4)
10
+ bundler (~> 1.0)
11
+ git (>= 1.2.5)
12
+ rake
13
+ rake (0.9.2)
14
+ rcov (0.9.9)
15
+ thor (0.14.6)
16
+ turn (0.8.2)
17
+ ansi (>= 1.2.2)
18
+ yard (0.7.2)
19
+
20
+ PLATFORMS
21
+ ruby
22
+
23
+ DEPENDENCIES
24
+ activesupport
25
+ archive-tar-minitar
26
+ bundler (~> 1.0.0)
27
+ i18n
28
+ jeweler (~> 1.6.4)
29
+ rcov
30
+ thor
31
+ turn
32
+ yard
data/LICENSE.txt ADDED
@@ -0,0 +1,14 @@
1
+ Copyright 2011 Tommy Poulter
2
+
3
+ basechip is free software: you can redistribute it and/or modify
4
+ it under the terms of the GNU General Public License as published by
5
+ the Free Software Foundation, either version 3 of the License, or
6
+ (at your option) any later version.
7
+
8
+ basechip is distributed in the hope that it will be useful,
9
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ GNU General Public License for more details.
12
+
13
+ You should have received a copy of the GNU General Public License
14
+ along with basechip. If not, see <http://www.gnu.org/licenses/>.
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = basechip
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to basechip
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
+ * Fork the project
10
+ * Start a feature/bugfix branch
11
+ * Commit and push until you are happy with your contribution
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2011 Tommy Poulter. See LICENSE.txt for
18
+ further details.
19
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/bin/basechip ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Copyright 2011 Tommy Poulter
4
+ #
5
+ # This file is part of basechip.
6
+ #
7
+ # basechip is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License version 3 as
9
+ # published by the Free Software Foundation.
10
+ #
11
+ # basechip is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with basechip. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ begin
20
+ # require "base_chip"
21
+ # rescue LoadError
22
+ path = File.expand_path('../../lib', __FILE__)
23
+ $:.unshift(path)
24
+ require "base_chip"
25
+ end
@@ -0,0 +1,20 @@
1
+
2
+ # these routines search for and install various settings in the base_chip/
3
+ # folder
4
+ discover_recipes
5
+ discover_tools
6
+ discover_configurations
7
+ discover_actions
8
+ discover_test_lists
9
+
10
+ # define configurations and actions applicable for all configurations
11
+ # configuration :block_name do |b|
12
+ # Things to do
13
+ # end
14
+
15
+ # define defaults for any setting on any element in the data structure below
16
+ # this block
17
+ # delete_on_pass true
18
+ # zip_on_fail true
19
+
20
+
@@ -0,0 +1,19 @@
1
+
2
+ # these routines search for and install various settings in the base_chip/
3
+ # folder
4
+ discover_recipes
5
+ discover_tools
6
+ discover_actions
7
+ discover_test_lists
8
+
9
+ # define configurations and actions applicable for all configurations
10
+ # configuration :block_name do |b|
11
+ # Things to do
12
+ # end
13
+
14
+ # define defaults for any setting on any element in the data structure below
15
+ # this block
16
+ # delete_on_pass true
17
+ # zip_on_fail true
18
+
19
+
@@ -0,0 +1,19 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ gem 'archive-tar-minitar'
7
+ gem 'activesupport'
8
+ gem 'i18n'
9
+ gem 'thor'
10
+
11
+ # Add dependencies to develop your gem here.
12
+ # Include everything needed to run rake, tests, features, etc.
13
+ group :development do
14
+ #gem "shoulda", ">= 0"
15
+ gem "bundler", "~> 1.0.0"
16
+ gem "jeweler", "~> 1.6.4"
17
+ gem "rcov", ">= 0"
18
+ gem "turn", :require=>false
19
+ end
@@ -0,0 +1,6 @@
1
+ *.dbg
2
+ *.dbg.gz
3
+ *.vcd
4
+ *.vcd.gz
5
+ out
6
+ reports
@@ -0,0 +1,76 @@
1
+ # This file contains the configuration for the project 'usbhostslave', and is
2
+ # executed from within that project
3
+
4
+
5
+ # This routine sets up the default directory structure for finding source
6
+ # files according to language and purpose. You can define your own
7
+ # directory structure if you prefer. The directory structure is primarily
8
+ # used for creating build lists, and can be ignored/omitted if you don't need
9
+ # BaseChip to generate build lists.
10
+ default_directory_structure
11
+ default_modes
12
+
13
+ # A directory needs to be set up as a landing place for installed tools and
14
+ # blocks not stored in the repository.
15
+ shared_directory '/home/poulter/silicon/basechip/test/examples/soc2/shared'
16
+
17
+
18
+ # These routines search for and execute various settings files in the base_chip/
19
+ # folder.
20
+ discover_recipes # Execute all files in base_chip/recipes in this context
21
+
22
+ discover_subprojects # Find all files in base_chip/subprojects or
23
+ # base_chip/project.rb in subdirectories, add a
24
+ # subproject for each, and execute the file within
25
+ # that block's context.
26
+
27
+ discover_blocks # Find all files in base_chip/blocks or base_chip/block.rb
28
+ # in subdirectories, add a block for each, and execute
29
+ # the file within that block's context.
30
+ discover_configurations # Find all files in base_chip/configurations, add a tool
31
+ # for each, and execute the file within that
32
+ # configuration's context.
33
+
34
+ discover_tools # Find all files in base_chip/tools, add a tool for each,
35
+ # and execute the file within that tool's context.
36
+ discover_actions # Find all files in base_chip/actions, add an action for
37
+ # each, and execute the file within that action's
38
+ # context
39
+ discover_test_lists # Find all files in base_chip/test_lists, add a test
40
+ # list for each, and execute the file within that test
41
+ # list's context.
42
+
43
+ discover_cluster_types # Find all files in base_chip/cluster_types, add a
44
+ # cluster_type for each, and execute the file within
45
+ # that cluster_type's context.
46
+
47
+
48
+ # blocks need at least one configuration. The :default configuration has
49
+ # special meaning, as it is used when no configuration is specified on the
50
+ # command line or when referencing a subblock. This can be removed, but
51
+ # defining it here adds it to all blocks and generally saves time.
52
+ # "remove_configuration :default" can be called for the blocks that don't
53
+ # want this configuration present.
54
+ configuration :default do |c|
55
+ end
56
+
57
+ block :wrapper do |b|
58
+ b.action :icarun do |a|
59
+ a.pass_regex /Finished all tests/
60
+ end
61
+ end
62
+ block :usbDevice do |b|
63
+ b.action :icarun do |a|
64
+ a.pass_regex /Finished all tests/
65
+ end
66
+ end
67
+
68
+ # # If discover_blocks isn't being used, you can define blocks and
69
+ # # configurations/actions applicable for all blocks as shown below
70
+ # block :block_name do |b|
71
+ # Things to do
72
+ # end
73
+
74
+ # # define defaults for any setting on any element in the data structure
75
+ # delete_on_pass true
76
+ # zip_on_fail true
@@ -0,0 +1,26 @@
1
+
2
+ project :<%= BaseChip.project %> do |p|
3
+
4
+ # this routine sets up the default directory structure for finding source
5
+ # files according to language and purpose
6
+ p.default_directory_structure
7
+
8
+ # these routines search for and install various settings in the base_chip/
9
+ # folder
10
+ p.discover_recipes
11
+ p.discover_tools
12
+ p.discover_blocks
13
+ p.discover_configurations
14
+ p.discover_actions
15
+ p.discover_test_lists
16
+
17
+ # define blocks and configurations/actions applicable for all blocks
18
+ # p.block :block_name do |b|
19
+ # Things to do
20
+ # end
21
+
22
+ # define defaults for any setting on any element in the data structure
23
+ # p.delete_on_pass true
24
+ # p.zip_on_fail true
25
+
26
+ end
@@ -0,0 +1,73 @@
1
+ # Copyright 2011 Tommy Poulter
2
+ #
3
+ # This file is part of basechip.
4
+ #
5
+ # basechip is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License version 3 as
7
+ # published by the Free Software Foundation.
8
+ #
9
+ # basechip is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with basechip. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ tool :icarus do |t|
18
+ t.default_version "0.9.4"
19
+
20
+ t.packages :ubuntu => %w{ build-essential
21
+ git-core
22
+ wget
23
+ }
24
+ vs = %w{0.4 0.6 0.6.1 0.7 0.8 0.8.1 0.8.2 0.8.3 0.8.4 0.8.5 0.8.6 0.8.7 0.9.1 0.9.2 0.9.3 0.9.4 cvshead elaborate-net-rework embedded-vvp master pei-branch performance v0_6-branch v0_8-branch v0_8-devel v0_9-branch var-array-rework verilog-ams version0_1 vvp-net-out-rework}
25
+ vs.each do |name|
26
+ t.version name do |v|
27
+ v.install %{
28
+ mkdir -p #{v.path} &&
29
+ git clone git://icarus.com/~steve-icarus/verilog #{v.tool.path}/tmp &&
30
+ cd #{v.tool.path}/tmp &&
31
+ #{
32
+ case v.name
33
+ when /^[\d\.]+$/; "git checkout v#{v.name.gsub(/\./,'_')} &&\n"
34
+ when 'master' ;
35
+ else ; "git checkout #{ v.name } &&\n"
36
+ end
37
+ } sh autoconf.sh &&
38
+ ./configure --prefix=#{v.path} &&
39
+ make &&
40
+ make install &&
41
+ rm -rf #{v.tool.path}/tmp
42
+ }
43
+ end
44
+ end
45
+ end
46
+
47
+ action :icarus do |a|
48
+ a.log_to "icarus.log"
49
+ a.out_file "icarus.log" do end
50
+
51
+ a.before lambda {
52
+ f = File.open("icarus.f","w")
53
+ f.puts((a.configuration.bom.headers.to_a.map{|h| "+incdir+#{h}"} +
54
+ a.configuration.bom.verilog.to_a ).join("\n"))
55
+ f.close
56
+ }
57
+
58
+ a.configuration.tools[:icarus].configure
59
+ a.command "#{a.configuration.tools[:icarus].path}/bin/iverilog #{a.args} -f icarus.f"
60
+ end
61
+
62
+ action :icarun do |a|
63
+ a.log_to "icarun.log"
64
+ a.out_file "icarun.log" do end
65
+
66
+ a.append_depends [:icarus]
67
+
68
+ a.args BaseChip.options.replace_arguments.join(' ') if BaseChip.options.replace_arguments
69
+
70
+ a.configuration.actions[:icarus].configure
71
+ a.command "#{a.configuration.actions[:icarus].directory}/a.out #{BaseChip.options.append_arguments.join(' ') if BaseChip.options.append_arguments} #{a.args}"
72
+ end
73
+
@@ -0,0 +1,88 @@
1
+ # Copyright 2011 Tommy Poulter
2
+ #
3
+ # This file is part of basechip.
4
+ #
5
+ # basechip is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License version 3 as
7
+ # published by the Free Software Foundation.
8
+ #
9
+ # basechip is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with basechip. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ <%
18
+ default_version = nil
19
+ vs = []
20
+
21
+ `git ls-remote git://icarus.com/~steve-icarus/verilog`.split(/\n/).each do |b|
22
+ next unless b = case b
23
+ when /refs\/tags\/v([\d_]+\d)$/; default_version = $1.gsub(/_/,'.')
24
+ when /refs\/heads\/(.*)$/ ; $1
25
+ end
26
+
27
+ vs << b
28
+ end
29
+ vs.sort!
30
+ %>
31
+
32
+ tool :icarus do |t|
33
+ t.default_version <%= default_version.inspect %>
34
+
35
+ t.packages :ubuntu => %w{ build-essential
36
+ git-core
37
+ wget
38
+ }
39
+ vs = %w{<%= vs.join(' ') %>}
40
+ vs.each do |name|
41
+ t.version name do |v|
42
+ v.install %{
43
+ mkdir -p #{v. path} &&
44
+ git clone git://icarus.com/~steve-icarus/verilog #{v.tool.path}/tmp &&
45
+ cd #{v.tool.path}/tmp &&
46
+ #{
47
+ case v.name
48
+ when /^[\d\.]+$/; "git checkout v#{v.name.gsub(/\./,'_')} &&\n"
49
+ when 'master' ;
50
+ else ; "git checkout #{ v.name } &&\n"
51
+ end
52
+ } sh autoconf.sh &&
53
+ ./configure --prefix=#{v.path} &&
54
+ make &&
55
+ make install &&
56
+ rm -rf #{v.tool.path}/tmp
57
+ }
58
+ end
59
+ end
60
+ end
61
+
62
+ action :icarus do |a|
63
+ a.log_to "icarus.log"
64
+ a.out_file "icarus.log" do end
65
+
66
+ a.before lambda {
67
+ f = File.open("icarus.f","w")
68
+ f.puts((a.configuration.bom.headers.to_a.map{|h| "+incdir+#{h}"} +
69
+ a.configuration.bom.verilog.to_a ).join("\n"))
70
+ f.close
71
+ }
72
+
73
+ a.configuration.tools[:icarus].configure
74
+ a.command "#{a.configuration.tools[:icarus].path}/bin/iverilog #{a.args} -f icarus.f"
75
+ end
76
+
77
+ action :icarun do |a|
78
+ a.log_to "icarun.log"
79
+ a.out_file "icarun.log" do end
80
+
81
+ a.append_depends [:icarus]
82
+
83
+ a.args BaseChip.options.replace_arguments.join(' ') if BaseChip.options.replace_arguments
84
+
85
+ a.configuration.actions[:icarus].configure
86
+ a.command "#{a.configuration.actions[:icarus].directory}/a.out #{BaseChip.options.append_arguments.join(' ') if BaseChip.options.append_arguments} #{a.args}"
87
+ end
88
+
@@ -0,0 +1,27 @@
1
+ # Copyright 2011 Tommy Poulter
2
+ #
3
+ # This file is part of basechip.
4
+ #
5
+ # basechip is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License version 3 as
7
+ # published by the Free Software Foundation.
8
+ #
9
+ # basechip is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with basechip. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ cluster_type :local do |t|
18
+ t.cluster :default do |c|
19
+ # Process.spawn issues the command and returns the process id
20
+ c.submit_procedure lambda { |command|
21
+ Process.spawn command
22
+ }
23
+ # Don't need a procedure here. BaseChip will add the id returned from submit_procedure to this command
24
+ c.kill_command "kill -9"
25
+ end
26
+ end
27
+
data/lib/array.rb ADDED
@@ -0,0 +1,26 @@
1
+ # Copyright 2011 Tommy Poulter
2
+ #
3
+ # This file is part of basechip.
4
+ #
5
+ # basechip is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License version 3 as
7
+ # published by the Free Software Foundation.
8
+ #
9
+ # basechip is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with basechip. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ class Array
18
+ def nice_or
19
+ case size
20
+ when 0; raise "nice_or should not be called on an empty array"
21
+ when 1; self[0]
22
+ when 2; "#{self[0] } or #{self[-1]}"
23
+ else "#{self[0 .. -2].join(', ')} or #{self[-1]}"
24
+ end
25
+ end
26
+ end