fhlow 1.91.0 → 1.91.1

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.
Files changed (59) hide show
  1. data/bin/fhlow +58 -10
  2. data/lib/module_config/complexitem.rb +57 -0
  3. data/lib/module_config/config.rb +5 -3
  4. data/lib/module_config/item.rb +0 -4
  5. data/lib/module_config/items/complex.rb +44 -0
  6. data/lib/module_config/items/complexfreqencies.rb +59 -0
  7. data/lib/module_config/items/complexlibrary.rb +46 -0
  8. data/lib/module_config/items/complexpackage.rb +47 -0
  9. data/lib/module_config/items/complexpins.rb +59 -0
  10. data/lib/module_config/items/complexunit.rb +53 -0
  11. data/lib/module_config/items/simple.rb +29 -0
  12. data/lib/module_config/items/simplearchitecture.rb +34 -0
  13. data/lib/module_config/items/simplebindir.rb +31 -0
  14. data/lib/module_config/items/simplebool.rb +24 -0
  15. data/lib/module_config/items/simplepostlayoutsdf.rb +24 -0
  16. data/lib/module_config/items/simplesimulaterun.rb +25 -0
  17. data/lib/module_config/items/simpleverbose.rb +33 -0
  18. data/lib/module_config/section.rb +16 -4
  19. data/lib/module_config/simpleitem.rb +37 -0
  20. data/lib/module_config/test.flw +33 -12
  21. data/lib/module_config/test.rb +54 -4
  22. data/lib/module_config/unittests/config_test.rb +15 -12
  23. data/lib/module_fhlow/leaf.rb +28 -24
  24. data/lib/module_fhlow/leafs/Library.rb +60 -0
  25. data/lib/module_fhlow/leafs/Package.rb +4 -1
  26. data/lib/module_fhlow/leafs/Unit.rb +9 -1
  27. data/lib/module_fhlow/node.rb +4 -5
  28. data/lib/module_fhlow/plugin.rb +11 -0
  29. data/lib/module_fhlow/pluginpool.rb +17 -5
  30. data/lib/module_fhlow/rootnode.rb +4 -3
  31. data/lib/plugins/Modelsim.flw +18 -0
  32. data/lib/plugins/Modelsim.rb +331 -0
  33. data/lib/plugins/Quartus.flw +5 -0
  34. data/lib/plugins/Quartus.rb +237 -0
  35. data/tests/testsuite.rb +0 -0
  36. metadata +84 -79
  37. data/lib/module_config/configitems/complex.rb +0 -71
  38. data/lib/module_config/configitems/complexpackage.rb +0 -67
  39. data/lib/module_config/configitems/complexunit.rb +0 -76
  40. data/lib/module_config/configitems/simple.rb +0 -56
  41. data/lib/module_config/configitems/simplearchitecture.rb +0 -52
  42. data/lib/module_config/configitems/simplepackage.rb +0 -47
  43. data/lib/module_config/configitems/simpleunit.rb +0 -53
  44. data/lib/module_config/configs.test +0 -24
  45. data/lib/module_config/tmp +0 -3
  46. data/lib/module_config/unittests/coverage/-home-simon-tmp-fhlow_v2-flw-core-lib-module_config-configexception_rb.html +0 -647
  47. data/lib/module_config/unittests/coverage/-home-simon-tmp-fhlow_v2-flw-core-lib-module_config-configitems-complex_rb.html +0 -700
  48. data/lib/module_config/unittests/coverage/-home-simon-tmp-fhlow_v2-flw-core-lib-module_config-configitems-complexpackage_rb.html +0 -694
  49. data/lib/module_config/unittests/coverage/-home-simon-tmp-fhlow_v2-flw-core-lib-module_config-configitems-complexunit_rb.html +0 -704
  50. data/lib/module_config/unittests/coverage/-home-simon-tmp-fhlow_v2-flw-core-lib-module_config-configitems-simple_rb.html +0 -685
  51. data/lib/module_config/unittests/coverage/-home-simon-tmp-fhlow_v2-flw-core-lib-module_config-configitems-simplepackage_rb.html +0 -676
  52. data/lib/module_config/unittests/coverage/-home-simon-tmp-fhlow_v2-flw-core-lib-module_config-configitems-simpleunit_rb.html +0 -682
  53. data/lib/module_config/unittests/coverage/-home-simon-tmp-fhlow_v2-flw-core-lib-module_config-item_rb.html +0 -663
  54. data/lib/module_config/unittests/coverage/-home-simon-tmp-fhlow_v2-flw-core-lib-module_config-itemfactory_rb.html +0 -687
  55. data/lib/module_config/unittests/coverage/-home-simon-tmp-fhlow_v2-flw-core-lib-module_config-myconfig_rb.html +0 -687
  56. data/lib/module_config/unittests/coverage/-home-simon-tmp-fhlow_v2-flw-core-lib-module_config-section_rb.html +0 -692
  57. data/lib/module_config/unittests/coverage/index.html +0 -689
  58. data/lib/module_fhlow/leaf.rb~ +0 -202
  59. data/lib/module_fhlow/test.rb +0 -15
@@ -0,0 +1,53 @@
1
+ require 'complexitem'
2
+ require 'itemfactory'
3
+ require 'configexception'
4
+
5
+ module Config
6
+
7
+ class ComplexUnitFactory < ItemFactory
8
+ @@nameregex = /\w*Unit\w*/
9
+ @@valueregex = /(\s*.*[;]\s*)*(\s*.*\(.*\)[;]*\s*)?/
10
+
11
+ def ComplexUnitFactory.match(_str)
12
+ _str.sub!(ComplexItem.getRegex(@@nameregex, @@valueregex), '')
13
+ return $&
14
+ end
15
+
16
+ def ComplexUnitFactory.create(_str)
17
+ ComplexUnit.new(_str, ComplexItem.getRegex(@@nameregex, @@valueregex))
18
+ end
19
+ end
20
+
21
+ class ComplexUnit < ComplexItem
22
+ @@subitemregex = /\A(([\w\/]+,\s*)*[\w\/]+)\s*\((.+)\)\Z/
23
+
24
+ def initialize(_str, _regex)
25
+ super(_str, _regex)
26
+
27
+ tmp = @value
28
+ @value = []
29
+ tmp.each do |item|
30
+ item.strip!
31
+ if item =~ @@subitemregex
32
+ item = Hash.new
33
+ item["deppath"] = $1
34
+ item["archs"] = $3.split(/,\s*/)
35
+ item["deppath"] = item["deppath"].split(/,\s*/)
36
+ @value.push(item)
37
+ else
38
+ raise ConfigWrongFormatException.new(self.class), "Configuration subitem <#{item}> of item <#{name}> has wrong format."
39
+ end
40
+
41
+ end
42
+ end
43
+
44
+ def print
45
+ puts " #{@name} = { ##{self.class.to_s}"
46
+ @value.each { |v| puts " #{v["deppath"].join(", ")}(#{v["archs"].join(", ")});" }
47
+ puts " }"
48
+ end
49
+
50
+ end
51
+
52
+ end
53
+
@@ -0,0 +1,29 @@
1
+ require 'simpleitem'
2
+ require 'itemfactory'
3
+
4
+ module Config
5
+
6
+ class SimpleFactory < ItemFactory
7
+ @@nameregex = /\w+/
8
+ @@valueregex = /[\w\-,\/\\:.;\t @]*/
9
+
10
+ def SimpleFactory.match(_str)
11
+ _str.sub!(SimpleItem.getRegex(@@nameregex, @@valueregex), '')
12
+ return $&
13
+ end
14
+
15
+ def SimpleFactory.create(_str)
16
+ Simple.new(_str, SimpleItem.getRegex(@@nameregex, @@valueregex))
17
+ end
18
+
19
+ def SimpleFactory.priority
20
+ 10
21
+ end
22
+ end
23
+
24
+
25
+ class Simple < SimpleItem
26
+ end
27
+
28
+ end
29
+
@@ -0,0 +1,34 @@
1
+ require 'itemfactory'
2
+ require 'simpleitem'
3
+ require 'configexception'
4
+
5
+ module Config
6
+
7
+ class SimpleArchitectureFactory < ItemFactory
8
+ @@nameregex = /\w*Architecture[s]?/
9
+ @@valueregex = /((\s*\w+\s*[,])*\s*\w+)*/
10
+
11
+
12
+ def SimpleArchitectureFactory.match(_str)
13
+ _str.sub!(SimpleItem.getRegex(@@nameregex, @@valueregex), '')
14
+ return $&
15
+ end
16
+
17
+ def SimpleArchitectureFactory.create(_str)
18
+ SimpleArchitecture.new(_str, SimpleItem.getRegex(@@nameregex, @@valueregex))
19
+ end
20
+ end
21
+
22
+
23
+ class SimpleArchitecture < SimpleItem
24
+ def initialize(_str, _regex)
25
+ super(_str, _regex)
26
+ @value = [] unless @value = @value.split(/,\s*/)
27
+ end
28
+
29
+ def print
30
+ puts " #{@name} = #{@value.join(", ")}\t##{self.class.to_s}"
31
+ end
32
+
33
+ end
34
+ end
@@ -0,0 +1,31 @@
1
+ require 'simpleitem'
2
+ require 'itemfactory'
3
+
4
+ module Config
5
+
6
+ class SimpleBinDirFactory < ItemFactory
7
+ @@nameregex = /BinDir/
8
+ @@valueregex = /[\w.\/\\\- ]*/
9
+
10
+ def SimpleBinDirFactory.match(_str)
11
+ _str.sub!(SimpleItem.getRegex(@@nameregex, @@valueregex), '')
12
+ return $&
13
+ end
14
+
15
+ def SimpleBinDirFactory.create(_str)
16
+ SimpleBinDir.new(_str, SimpleItem.getRegex(@@nameregex, @@valueregex))
17
+ end
18
+
19
+ end
20
+
21
+
22
+ class SimpleBinDir < SimpleItem
23
+ def initialize(_str, _regex)
24
+ super(_str, _regex)
25
+ raise ConfigWrongFormatException.new(self.class), "The value of BinDir (#{@value}) is no valid directory!" unless File.directory?(@value) or @value==""
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+
@@ -0,0 +1,24 @@
1
+ require 'itemfactory'
2
+ require 'simpleitem'
3
+ require 'configexception'
4
+
5
+ module Config
6
+
7
+ class SimpleBoolFactory < ItemFactory
8
+ @@nameregex = /SimulateConsole|CompileBuildAll/
9
+ @@valueregex = /true|false/
10
+
11
+ def SimpleBoolFactory.match(_str)
12
+ _str.sub!(SimpleItem.getRegex(@@nameregex, @@valueregex), '')
13
+ return $&
14
+ end
15
+
16
+ def SimpleBoolFactory.create(_str)
17
+ SimpleBool.new(_str, SimpleItem.getRegex(@@nameregex, @@valueregex))
18
+ end
19
+ end
20
+
21
+
22
+ class SimpleBool < SimpleItem
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ require 'itemfactory'
2
+ require 'simpleitem'
3
+ require 'configexception'
4
+
5
+ module Config
6
+
7
+ class SimpelPostLayoutSimSDFFactory < ItemFactory
8
+ @@nameregex = /PostLayoutSimSDF/
9
+ @@valueregex = /max|min/
10
+
11
+ def SimpelPostLayoutSimSDFFactory.match(_str)
12
+ _str.sub!(SimpleItem.getRegex(@@nameregex, @@valueregex), '')
13
+ return $&
14
+ end
15
+
16
+ def SimpelPostLayoutSimSDFFactory.create(_str)
17
+ SimpelPostLayoutSimSDF.new(_str, SimpleItem.getRegex(@@nameregex, @@valueregex))
18
+ end
19
+ end
20
+
21
+
22
+ class SimpelPostLayoutSimSDF < SimpleItem
23
+ end
24
+ end
@@ -0,0 +1,25 @@
1
+ require 'itemfactory'
2
+ require 'simpleitem'
3
+ require 'configexception'
4
+
5
+ module Config
6
+
7
+ class SimpleSimulateRunFactory < ItemFactory
8
+ @@nameregex = /SimulateRun/
9
+ @@valueregex = /\d+[ ](ms|us|ns|ps)/
10
+
11
+
12
+ def SimpleSimulateRunFactory.match(_str)
13
+ _str.sub!(SimpleItem.getRegex(@@nameregex, @@valueregex), '')
14
+ return $&
15
+ end
16
+
17
+ def SimpleSimulateRunFactory.create(_str)
18
+ SimpleSimulateRun.new(_str, SimpleItem.getRegex(@@nameregex, @@valueregex))
19
+ end
20
+ end
21
+
22
+
23
+ class SimpleSimulateRun < SimpleItem
24
+ end
25
+ end
@@ -0,0 +1,33 @@
1
+ require 'itemfactory'
2
+ require 'simpleitem'
3
+ require 'configexception'
4
+
5
+ module Config
6
+
7
+ class SimpleVerboseFactory < ItemFactory
8
+ @@nameregex = /Verbose/
9
+ @@valueregex = /\d*/
10
+
11
+ def SimpleVerboseFactory.match(_str)
12
+ _str.sub!(SimpleItem.getRegex(@@nameregex, @@valueregex), '')
13
+ return $&
14
+ end
15
+
16
+ def SimpleVerboseFactory.create(_str)
17
+ SimpleVerbose.new(_str, SimpleItem.getRegex(@@nameregex, @@valueregex))
18
+ end
19
+ end
20
+
21
+
22
+ class SimpleVerbose < SimpleItem
23
+ def initialize(_str, _regex)
24
+ super(_str, _regex)
25
+
26
+ begin
27
+ @value = Integer(@value)
28
+ rescue ArgumentError => e
29
+ raise ConfigWrongFormatException.new(self.class), "Configuration item <#{@name} = #{@value}> has wrong format!"
30
+ end
31
+ end
32
+ end
33
+ end
@@ -4,15 +4,16 @@ require 'configexception'
4
4
  module Config
5
5
 
6
6
  class Section
7
- @@beginName = '[\[]'
7
+ @@beginName = '^\s*[\[]'
8
8
  @@name = '[\w\s]+'
9
- @@endName = '[\]]'
9
+ @@endName = '[\]]\s*$'
10
10
  @@regex = /#{@@beginName}#{@@name}#{@@endName}[^\[]+/
11
11
 
12
12
  attr_reader :name
13
13
 
14
14
 
15
- def initialize(_str)
15
+ def initialize(_str, _filename)
16
+ @filename = _filename
16
17
  @items = []
17
18
  str = _str.sub(/#{@@beginName}(#{@@name})#{@@endName}/, '')
18
19
  @name = $1
@@ -33,8 +34,19 @@ module Config
33
34
  @items.each(&block)
34
35
  end
35
36
 
37
+ def item_each(_name, &_block)
38
+ ifnotfound = lambda { raise Fhlow::FhlowException.new("Config::Section"), "#{@filename}\n No such item <#{_name}> in section <#{@name}>" }
39
+ i = @items.detect(ifnotfound) { |item| item.name == _name }
40
+ i.each(&_block)
41
+ end
42
+
43
+ def getItem(_name)
44
+ ifnotfound = lambda { raise Fhlow::FhlowException.new("Config::Section"), "#{@filename}\n No such item <#{_name}> in section <#{@name}>" }
45
+ @items.detect(ifnotfound) { |item| item.name == _name }
46
+ end
47
+
36
48
  def [](_name)
37
- ifnotfound = lambda { raise Fhlow::FhlowException.new("Config::Section"), "No such section. <#{_name}>" }
49
+ ifnotfound = lambda { raise Fhlow::FhlowException.new("Config::Section"), "#{@filename}\n No such item <#{_name}> in section <#{@name}>" }
38
50
  i = @items.detect(ifnotfound) { |item| item.name == _name }
39
51
  i.value
40
52
  end
@@ -0,0 +1,37 @@
1
+ require 'item'
2
+ require 'itemfactory'
3
+ require 'configexception'
4
+
5
+ module Config
6
+
7
+ class SimpleItem < Item
8
+ attr_reader :name
9
+ attr_reader :value
10
+
11
+ protected
12
+
13
+ def initialize(_str, _regex)
14
+ if _str =~ _regex
15
+ @name = $1
16
+ @value = $2
17
+ else
18
+ raise ConfigWrongFormatException.new(self.class), "Configuration item <#{_str}> has wrong format."
19
+ end
20
+ end
21
+
22
+ public
23
+ def merge(_item)
24
+ raise ConfigMergeException.new(self.class), "Merge: Configuration items do not fit! <#{_item}> is not of type #{self.class.to_s}." unless _item.instance_of?(self.class)
25
+ raise ConfigMergeException.new(self.class), "Merge: Configuration items do not have the same name! <#{_item.name}> vs. <#{@name}>" unless _item.name == @name
26
+ end
27
+
28
+ def print
29
+ puts " #{@name} = #{@value}\t##{self.class.to_s}"
30
+ end
31
+
32
+ def SimpleItem.getRegex(_nameregex, _valueregex)
33
+ /^\s*(#{_nameregex})\s*=\s*(#{_valueregex})\s*$/
34
+ end
35
+ end
36
+
37
+ end
@@ -1,20 +1,41 @@
1
- [a section]
2
1
 
3
- [another section]
4
- ComplexUnits = {
5
- 1,2;
6
- 3(bla);
7
- 4,5,6(bhv)
2
+
3
+ [Dependencies]
4
+ Packages = {
5
+ Prol16, Prol16
6
+ }
7
+
8
+ Units = {
9
+ DataPath(Rtl);
10
+ CoreControl (Rtl)
11
+ }
12
+
13
+ BhvUnits = {
14
+ Prol16, memory (beh)
8
15
  }
9
16
 
10
- ComplexPackage = {
11
- a,b,c;
12
- d,e,f
17
+ tbUnits = {
13
18
  }
14
19
 
15
- Unit = blablablal(bla)
20
+ Libraries! = {
21
+
22
+ }
16
23
 
17
- Package = asdfja
18
- some = thing else
24
+ [Quartus]
25
+ BinDir = /bla
19
26
 
27
+ [Self]
28
+ gaga = gaga
29
+ Architectures = Rtl
30
+ tbArchitectures = Bhv
31
+ BhvArchitectures =
20
32
 
33
+
34
+ [Target]
35
+ Target = SandboxX
36
+
37
+
38
+ [fhlow]
39
+ LeafPrefixes = {
40
+ unit, pkg, lib
41
+ }
@@ -5,8 +5,9 @@ require 'profile' if $DEBUG
5
5
  def show_regexp(a, re)
6
6
  if a =~ re
7
7
  puts "#{$`}<<#{$&}>>#{$'}"
8
- puts "<#{$1}>"
9
- puts "<#{$2}>"
8
+ # puts "1: <#{$1}>"
9
+ # puts "2: <#{$2}>"
10
+ # puts "3: <#{$3}>"
10
11
  else
11
12
  puts "no match"
12
13
  end
@@ -75,11 +76,60 @@ a = "ComplexUnits = {\n 1,2,3(bla);\n 4,5,6(bhv)\n
75
76
  show_regexp(show_regexp(str, /^\s*(\w+)\s*=\s*([\w,.;\s]+)\s*$/), /^\s*(\w+)\s*=\s*([\w,.;\s]+)\s*$/)
76
77
  =end
77
78
 
78
- require 'myconfig'
79
+ =begin
80
+ oMemAddr[1] -> PIN_6, false;
81
+ oMemAddr[2] -> PIN_7, false;
82
+ oMemAddr[3] -> PIN_8, false;
83
+ oMemAddr[4] -> PIN_9, false;
84
+ oMemAddr[5] -> PIN_10, false;
85
+ oMemAddr[6] -> PIN_11, false;
86
+ oMemAddr[7] -> PIN_12, false;
87
+ oMemAddr[8] -> PIN_13, false;
88
+ oMemAddr[9] -> PIN_14, false;
89
+ oMemAddr[10] -> PIN_15, false;
90
+ oMemAddr[11] -> PIN_16, false;
91
+ oMemAddr[12] -> PIN_17, false;
92
+ oMemAddr[13] -> PIN_18, false;
93
+ oMemAddr[14] -> PIN_19, false;
94
+ oMemAddr[15] -> PIN_21, false;
95
+ oMemData[0] -> PIN_22, false;
96
+ oMemData[1] -> PIN_23, false;
97
+ oMemData[2] -> PIN_24, false;
98
+ oMemData[3] -> PIN_25, false;
99
+ oMemData[4] -> PIN_26, false;
100
+ oMemData[5] -> PIN_27, false;
101
+ oMemData[6] -> PIN_28, false;
102
+ oMemData[7] -> PIN_29, false;
103
+ oMemData[8] -> PIN_30, false;
104
+ oMemData[9] -> PIN_31, false;
105
+ oMemData[10] -> PIN_32, false;
106
+ oMemData[11] -> PIN_33, false;
107
+ oMemData[12] -> PIN_34, false;
108
+ oMemData[13] -> PIN_35, false;
109
+ oMemData[14] -> PIN_36, false;
110
+ oMemData[15] -> PIN_37, false;
111
+ onMemCe -> PIN_38, false;
112
+ onMemOe -> PIN_39, false;
113
+ onMemWe -> PIN_40, false;
114
+ oIllegalInst -> PIN_41, false;
115
+ oCpuHalt -> PIN_42, false;
116
+ =end
117
+
118
+ #show_regexp(a, /^\s*[\[][\w\s]+[\]]\s*$^[^\[]+/ )
119
+ #show_regexp(a, /^\s*[\[][\w\s]+[\]](.*(?=(^\s*[\[][\w\s]+[\]]))|.*)/m )
120
+
121
+ #a.sub!(/(Pins)\s*=\s*\{((\s*.*[;]\s*)*(\s*.*[;]*\s*)?)\s*\}/, '')
122
+ #puts "<<<<#{$&}>>>>"
123
+ #puts "<<<<#{a}>>>>"
124
+
125
+ #show_regexp(File.read("test.flw"), /^\s*((?-mix:\w*Architecture[s]?))\s*=\s*((?-mix:((\s*\w+\s*[,])*\s*\w+)*))\s*$/)
126
+
127
+ require 'config'
79
128
 
80
129
  begin
81
- cfg = Config::Config.new("/home/simon/tmp/fhlow.v2/grpProl16/unitCpu/config.flw")
130
+ cfg = Config::Config.new("test.flw")
82
131
  cfg.print
132
+ # cfg["TargetSandboxX"].item_each("Pins") { |sig, pin, pull| p sig; p pin; p pull }
83
133
  rescue Config::ConfigException => e
84
134
  puts "Error:\n#{e.message}"
85
135
  end