Sha256: 7836ff750def4119e14b44af507ebffd4e809df6aaeb41ae8c67002dbd1a91d2

Contents?: true

Size: 1.51 KB

Versions: 18

Compression:

Stored size: 1.51 KB

Contents

module Origen
  module Tester
    class V93K
      module Generator
        class PatternMaster
          include Origen::Tester::Generator

          TEMPLATE = "#{Origen.top}/lib/origen/tester/v93k/generator/templates/template.pmfl.erb"

          def add(name, options = {})
            check_for_duplicates(name)
            record_pattern(name)
            p = Pattern.new(name, options)
            collection << p
            p
          end

          # Returns true if the given pattern name has already been added to the current pattern
          # master file.
          #
          # Pass in :global => true for all pattern sets sheets to be considered.
          def duplicate?(name, options = {})
            files = existing_patterns[name]
            if files && !files.empty?
              options[:global] || files.include?(filename)
            else
              false
            end
          end

          private

          def check_for_duplicates(name)
            if duplicate?(name)
              error "Duplicate pattern #{name} generated in #{filename}"
              exit 1
            elsif duplicate?(name, global: true)
              warning "Pattern #{name} is duplicated in: #{existing_patterns[name].join(', ')}"
            end
          end

          def existing_patterns
            @@existing_patterns ||= {}
          end

          def record_pattern(name)
            existing_patterns[name] ||= []
            existing_patterns[name] << filename
          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
origen-0.2.6 lib/origen/tester/v93k/generator/pattern_master.rb
origen-0.2.5 lib/origen/tester/v93k/generator/pattern_master.rb
origen-0.2.4 lib/origen/tester/v93k/generator/pattern_master.rb
origen-0.2.3 lib/origen/tester/v93k/generator/pattern_master.rb
origen-0.2.2 lib/origen/tester/v93k/generator/pattern_master.rb
origen-0.2.1 lib/origen/tester/v93k/generator/pattern_master.rb
origen-0.2.0 lib/origen/tester/v93k/generator/pattern_master.rb
origen-0.1.3 lib/origen/tester/v93k/generator/pattern_master.rb
origen-0.1.2 lib/origen/tester/v93k/generator/pattern_master.rb
origen-0.1.1 lib/origen/tester/v93k/generator/pattern_master.rb
origen-0.1.0 lib/origen/tester/v93k/generator/pattern_master.rb
origen-0.0.9 lib/origen/tester/v93k/generator/pattern_master.rb
origen-0.0.8 lib/origen/tester/v93k/generator/pattern_master.rb
origen-0.0.6 lib/origen/tester/v93k/generator/pattern_master.rb
origen-0.0.5 lib/origen/tester/v93k/generator/pattern_master.rb
origen-0.0.4 lib/origen/tester/v93k/generator/pattern_master.rb
origen-0.0.3 lib/origen/tester/v93k/generator/pattern_master.rb
origen-0.0.2 lib/origen/tester/v93k/generator/pattern_master.rb