flgen 0.15.0 → 0.16.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.
- checksums.yaml +4 -4
- data/README.md +4 -3
- data/lib/flgen/context.rb +4 -6
- data/lib/flgen/formatter.rb +14 -4
- data/lib/flgen/source_file.rb +5 -13
- data/lib/flgen/version.rb +1 -1
- data/lib/flgen/vivado_tcl_formatter.rb +54 -0
- data/lib/flgen.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ffab1952f67689d9675b1a5f0ee47b4905b7ea098b5013b2467cfa54360e311
|
4
|
+
data.tar.gz: bd33d9997f06c4b6a00ab54a2df2fefe9ff86d9eb766d098ed787e500f289db6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d698fd487524fd93687db00ff03b73351579fd8499092960f6b077f42afc3fdbc2910926e95bd8a00e9d08cc47c60baa1478cf17309c008bc131371af1cd977f
|
7
|
+
data.tar.gz: 66c01f900315edc6d7355281112be92ef2e28eccfc174049c611959a5385b56b9ba1a9ee73f2102e34e250ead4a1a3805440c3e6c07a109d2c367312d279b1f1
|
data/README.md
CHANGED
@@ -10,7 +10,7 @@ FLGen provides a DSL to write filelists and generator tool to generate a filelis
|
|
10
10
|
|
11
11
|
### Ruby
|
12
12
|
|
13
|
-
FLGen is written in [Ruby](https://www.ruby-lang.org) programing language and its required version is 3.0 or later.
|
13
|
+
FLGen is written in [Ruby](https://www.ruby-lang.org) programing language and its required version is 3.0 or later. You need to install Ruby before using FLGen. See [this page](https://www.ruby-lang.org/en/documentation/installation/) for further details.
|
14
14
|
|
15
15
|
### Install FLGen
|
16
16
|
|
@@ -123,8 +123,9 @@ foo_project
|
|
123
123
|
* The generated filelist contains source file pash which has the specified file extentions.
|
124
124
|
* `--format=FORMAT`
|
125
125
|
* Specify the format of the generated filelist.
|
126
|
-
* If no format is specified
|
127
|
-
* If `
|
126
|
+
* If no format is specified FLGen will generate a generated filelist for major EDA tools.
|
127
|
+
* If `vivado-tcl` is specified FLGen will generate a TCL script to load source files for Vivado synthesis.
|
128
|
+
* If `filelist-xsim` is specified FLGen will generate a filelist for Vivado simulator.
|
128
129
|
* `--output=FILE`
|
129
130
|
* Specify the path of the generated filelist
|
130
131
|
* The generated fileslist is output to STDOUT if no path is specified.
|
data/lib/flgen/context.rb
CHANGED
@@ -78,17 +78,15 @@ module FLGen
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def source_file_already_added?(file)
|
81
|
-
|
82
|
-
|
81
|
+
return true if source_files.include?(file.path)
|
82
|
+
return true if checksums.include?(file.checksum)
|
83
83
|
|
84
|
-
|
85
|
-
|
86
|
-
checksums[path] << checksum
|
84
|
+
checksums << file.checksum
|
87
85
|
false
|
88
86
|
end
|
89
87
|
|
90
88
|
def checksums
|
91
|
-
@checksums ||=
|
89
|
+
@checksums ||= []
|
92
90
|
end
|
93
91
|
|
94
92
|
def add_macro_definition(name, value)
|
data/lib/flgen/formatter.rb
CHANGED
@@ -42,6 +42,10 @@ module FLGen
|
|
42
42
|
@context.options[:print_header] && !@context.options[:source_file_only]
|
43
43
|
end
|
44
44
|
|
45
|
+
def no_arguments?(type)
|
46
|
+
@context.arguments.none? { |argument| argument.type == type }
|
47
|
+
end
|
48
|
+
|
45
49
|
def each_argument(type, &block)
|
46
50
|
@context.arguments.each do |argument|
|
47
51
|
argument.type == type && block.call(argument)
|
@@ -49,7 +53,7 @@ module FLGen
|
|
49
53
|
end
|
50
54
|
|
51
55
|
def print_macros(io)
|
52
|
-
return if source_file_only?
|
56
|
+
return if source_file_only? || no_arguments?(:define)
|
53
57
|
|
54
58
|
pre_macros(io)
|
55
59
|
each_argument(:define) do |argument|
|
@@ -65,7 +69,7 @@ module FLGen
|
|
65
69
|
end
|
66
70
|
|
67
71
|
def print_include_directoris(io)
|
68
|
-
return if source_file_only?
|
72
|
+
return if source_file_only? || no_arguments?(:include)
|
69
73
|
|
70
74
|
pre_include_directories(io)
|
71
75
|
each_argument(:include) do |argument|
|
@@ -81,7 +85,7 @@ module FLGen
|
|
81
85
|
end
|
82
86
|
|
83
87
|
def print_arguments(io)
|
84
|
-
return if source_file_only?
|
88
|
+
return if source_file_only? || no_arguments?(:generic)
|
85
89
|
|
86
90
|
pre_arguments(io)
|
87
91
|
each_argument(:generic) do |argument|
|
@@ -101,13 +105,19 @@ module FLGen
|
|
101
105
|
end
|
102
106
|
|
103
107
|
def print_source_files(io)
|
108
|
+
return if no_source_files?
|
109
|
+
|
104
110
|
pre_source_files(io)
|
105
111
|
@context.source_files.each do |file|
|
106
|
-
io.puts(format_file_path(file.
|
112
|
+
io.puts(format_file_path(file.path))
|
107
113
|
end
|
108
114
|
post_source_files(io)
|
109
115
|
end
|
110
116
|
|
117
|
+
def no_source_files?
|
118
|
+
@context.source_files.empty?
|
119
|
+
end
|
120
|
+
|
111
121
|
def pre_source_files(_io)
|
112
122
|
end
|
113
123
|
|
data/lib/flgen/source_file.rb
CHANGED
@@ -3,35 +3,27 @@
|
|
3
3
|
module FLGen
|
4
4
|
class SourceFile
|
5
5
|
def initialize(root, path)
|
6
|
-
@
|
7
|
-
@path = path
|
6
|
+
@path = File.join(root, path)
|
8
7
|
end
|
9
8
|
|
10
|
-
attr_reader :root
|
11
9
|
attr_reader :path
|
12
10
|
|
13
|
-
def full_path
|
14
|
-
File.join(@root, @path)
|
15
|
-
end
|
16
|
-
|
17
11
|
def match_ext?(ext_list)
|
18
12
|
return false if ext_list.nil? || ext_list.empty?
|
19
13
|
|
20
|
-
file_ext = File.extname(@path)
|
21
|
-
ext_list.any?
|
22
|
-
(ext[0] == '.' && ext || ".#{ext}") == file_ext
|
23
|
-
end
|
14
|
+
file_ext = File.extname(@path)[1..]
|
15
|
+
ext_list.any? { |ext| (ext[0] == '.' && ext[1..] || ext) == file_ext }
|
24
16
|
end
|
25
17
|
|
26
18
|
def remove_ext(ext_list)
|
27
19
|
return self unless match_ext?(ext_list)
|
28
20
|
|
29
21
|
path = Pathname.new(@path).sub_ext('').to_s
|
30
|
-
self.class.new(
|
22
|
+
self.class.new('', path)
|
31
23
|
end
|
32
24
|
|
33
25
|
def checksum
|
34
|
-
@checksum ||= Digest::MD5.digest(File.read(
|
26
|
+
@checksum ||= Digest::MD5.digest(File.read(@path))
|
35
27
|
end
|
36
28
|
end
|
37
29
|
end
|
data/lib/flgen/version.rb
CHANGED
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FLGen
|
4
|
+
class VivadoTCLFormatter < Formatter
|
5
|
+
def format_header_line(line)
|
6
|
+
"# #{line}"
|
7
|
+
end
|
8
|
+
|
9
|
+
def pre_macros(io)
|
10
|
+
io.puts('set flgen_defines {}')
|
11
|
+
end
|
12
|
+
|
13
|
+
def format_macro(macro, value)
|
14
|
+
if value.nil?
|
15
|
+
"lappend flgen_defines \"#{macro}\""
|
16
|
+
else
|
17
|
+
"lappend flgen_defines \"#{macro}=#{value}\""
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def post_macros(io)
|
22
|
+
io.puts('set_property verilog_define $flgen_defines [current_fileset]')
|
23
|
+
end
|
24
|
+
|
25
|
+
def pre_include_directories(io)
|
26
|
+
io.puts('set flgen_include_directories {}')
|
27
|
+
end
|
28
|
+
|
29
|
+
def format_include_directory(directory)
|
30
|
+
"lappend flgen_include_directories \"#{directory}\""
|
31
|
+
end
|
32
|
+
|
33
|
+
def post_include_directories(io)
|
34
|
+
io.puts('set_property include_dirs $flgen_include_directories [current_fileset]')
|
35
|
+
end
|
36
|
+
|
37
|
+
def fomrat_argument(_)
|
38
|
+
end
|
39
|
+
|
40
|
+
def pre_source_files(io)
|
41
|
+
io.puts('set flgen_source_files {}')
|
42
|
+
end
|
43
|
+
|
44
|
+
def format_file_path(path)
|
45
|
+
"lappend flgen_source_files \"#{path}\""
|
46
|
+
end
|
47
|
+
|
48
|
+
def post_source_files(io)
|
49
|
+
io.puts('add_files -fileset [current_fileset] $flgen_source_files')
|
50
|
+
end
|
51
|
+
|
52
|
+
Formatter.add_formatter(:'vivado-tcl', self)
|
53
|
+
end
|
54
|
+
end
|
data/lib/flgen.rb
CHANGED
@@ -11,5 +11,6 @@ require_relative 'flgen/file_list'
|
|
11
11
|
require_relative 'flgen/context'
|
12
12
|
require_relative 'flgen/formatter'
|
13
13
|
require_relative 'flgen/file_list_formatter'
|
14
|
+
require_relative 'flgen/vivado_tcl_formatter'
|
14
15
|
require_relative 'flgen/file_list_xsim_formatter'
|
15
16
|
require_relative 'flgen/cli'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flgen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taichi Ishitani
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bump
|
@@ -130,6 +130,7 @@ files:
|
|
130
130
|
- lib/flgen/formatter.rb
|
131
131
|
- lib/flgen/source_file.rb
|
132
132
|
- lib/flgen/version.rb
|
133
|
+
- lib/flgen/vivado_tcl_formatter.rb
|
133
134
|
- sample/bar/bar.list.rb
|
134
135
|
- sample/bar/bar.sv
|
135
136
|
- sample/bar/baz/baz.list.rb
|
@@ -159,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
160
|
- !ruby/object:Gem::Version
|
160
161
|
version: '0'
|
161
162
|
requirements: []
|
162
|
-
rubygems_version: 3.4.
|
163
|
+
rubygems_version: 3.4.5
|
163
164
|
signing_key:
|
164
165
|
specification_version: 4
|
165
166
|
summary: Filelist generator
|