flgen 0.19.0 → 0.20.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: 93ba3a15351e9da39f2dfbbd23c54790140fe7134be768352aa2430533008194
4
- data.tar.gz: 0e4cc12fae241384ec559682d965b68a63362ca0c934013c1312ac93eaec28cb
3
+ metadata.gz: 17c6dc413fbc743f3014c128fc304fee0459fbe5ecc3fc9e7f9d12f0d26427d0
4
+ data.tar.gz: 262aec83a71a59ca34904e8be6f81787c5075ba5b9ac1726fb9668b3aa4832db
5
5
  SHA512:
6
- metadata.gz: 01ffbee882b46664e9e77a63977abe0e5c1de2a7c75271a1ce6b0284ce7a0517d1785d8e14d95c524959aedfbc8482f6dba3174001311034fd88d863cb013cd3
7
- data.tar.gz: 398adf788fa50f20d2cdda686b3364b8978a05884e554aecc19ae6c5beb908049a49e6de852b5d7ba41552e0c29310a9826c63c2e49fef2cd65899515133747f
6
+ metadata.gz: d5515a610870d4d9ff29db0cf01f09db1aa19beaa354c85894153e21732894d7f82a5d68ca959060aee97bf4791f6457a0ee61e06aaf4e69ed3a61fdf6051787
7
+ data.tar.gz: 5be5528a8aaa6d2ce79fa5fcf91adf9ed95977c5fedbb5a4c70a97164a2647862aa6231d0888dab7c5166495275c2f161bbfbad473b07ea00ad97f29b099e13d
data/lib/flgen/context.rb CHANGED
@@ -4,6 +4,7 @@ module FLGen
4
4
  class Context
5
5
  def initialize(options)
6
6
  @options = options
7
+ define_predefined_macros
7
8
  end
8
9
 
9
10
  attr_reader :options
@@ -35,7 +36,7 @@ module FLGen
35
36
  else
36
37
  [macro, value]
37
38
  end
38
- add_macro_definition(k.to_sym, v)
39
+ add_macro_definition(k, v, false)
39
40
  end
40
41
 
41
42
  def macros
@@ -95,8 +96,21 @@ module FLGen
95
96
  arguments.none? { |arg| arg.type == :library_file && arg.path == file }
96
97
  end
97
98
 
98
- def add_macro_definition(name, value)
99
+ def define_predefined_macros
100
+ return unless options[:tool]
101
+
102
+ list_name = File.join(__dir__, 'predefined_macros.yaml')
103
+ list = YAML.safe_load_file(list_name, filename: list_name, symbolize_names: true)
104
+ list[options[:tool]]&.each { |macro| add_macro_definition(macro, nil, true) }
105
+ end
106
+
107
+ def add_macro_definition(macro, value, predefined)
108
+ name = macro.to_sym
99
109
  macros << name unless macros.include?(name)
110
+ add_macro_argument(name, value) unless predefined
111
+ end
112
+
113
+ def add_macro_argument(name, value)
100
114
  arguments
101
115
  .delete_if { |argument| argument.type == :define && argument.name == name }
102
116
  add_compile_argument(Arguments::Define.new(name, value))
@@ -31,11 +31,12 @@ module FLGen
31
31
 
32
32
  def find_files(patterns, from: nil, &block)
33
33
  glob_files(patterns, from, __callee__, caller_location)
34
- .then { |e| block ? e.each(&block) : e.to_a }
34
+ .then { |e| block_given? && (return e.each(&block)) || e.to_a }
35
35
  end
36
36
 
37
37
  def find_file(patterns, from: nil)
38
- glob_files(patterns, from, __callee__, caller_location).first
38
+ glob_files(patterns, from, __callee__, caller_location)
39
+ .first&.then { |f| block_given? && (return yield f) || f }
39
40
  end
40
41
 
41
42
  def file?(path, from: :current)
@@ -117,7 +118,7 @@ module FLGen
117
118
  return
118
119
  end
119
120
 
120
- @context.__send__("add_#{method_name}".to_sym, extracted_path)
121
+ @context.__send__("add_#{method_name}", extracted_path)
121
122
  end
122
123
 
123
124
  def raise_no_entry_error(path, location, raise_error)
@@ -0,0 +1,12 @@
1
+ vcs:
2
+ - VCS
3
+ design_compiler:
4
+ - SYNTHESIS
5
+ formality:
6
+ - SYNTHESIS
7
+ xcelium:
8
+ - XCELIUM
9
+ vivado:
10
+ - SYNTHESIS
11
+ vivado_simulator:
12
+ - XILINX_SIMULATOR
data/lib/flgen/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FLGen
4
- VERSION = '0.19.0'
4
+ VERSION = '0.20.0'
5
5
  end
data/lib/flgen.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  require 'digest/md5'
4
4
  require 'optparse'
5
5
  require 'pathname'
6
+ require 'yaml'
6
7
  require_relative 'flgen/version'
7
8
  require_relative 'flgen/exceptions'
8
9
  require_relative 'flgen/source_file'
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.19.0
4
+ version: 0.20.0
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-09-15 00:00:00.000000000 Z
11
+ date: 2024-02-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Filelist generator
14
14
  email:
@@ -30,6 +30,7 @@ files:
30
30
  - lib/flgen/file_list_formatter.rb
31
31
  - lib/flgen/file_list_xsim_formatter.rb
32
32
  - lib/flgen/formatter.rb
33
+ - lib/flgen/predefined_macros.yaml
33
34
  - lib/flgen/source_file.rb
34
35
  - lib/flgen/version.rb
35
36
  - lib/flgen/vivado_tcl_formatter.rb
@@ -64,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
65
  - !ruby/object:Gem::Version
65
66
  version: '0'
66
67
  requirements: []
67
- rubygems_version: 3.4.19
68
+ rubygems_version: 3.5.3
68
69
  signing_key:
69
70
  specification_version: 4
70
71
  summary: Filelist generator