wip: more comfpile work

This commit is contained in:
xaseiresh 2023-04-24 09:20:31 +02:00
parent ac969681e6
commit cdb5492bfe
3 changed files with 57 additions and 31 deletions

View file

@ -145,13 +145,6 @@ $core.add_artefact_engine do |engine|
end
end
t_start = Time.now()
dep_art = $core.craft_and_complete(:gtkwave_output, "spi_master_tb.vhd")
t_end = Time.now()
puts "Full dependency list is: #{dep_art.dependencies.map(&:target)} (took #{t_end - t_start})"
puts "Includes of all source files:"
# (If you use this, don't forget to add pry to your Gemfile!)
require "pry"
Pry.start

View file

@ -2,37 +2,68 @@
module Comfpile
class ContextTag
def initialize(tag)
@@known_tags ||= {}
attr_reader :tag, :taglist
def self.form_context(tag)
@known_tags ||= {}
case tag
when Symbol, String
precompiled = @@known_tags[tag.to_sym]
when Symbol
tag_instance = @known_tags[tag]
if not precompiled.nil?
@tag = precompiled[:tag]
@tag_array = precompiled[:array]
else
@tag_array = tag.to_s.split('_').uniq.sort
end
when Array
@tag_array = tag.map(&:to_s).uniq.sort
@tag = @tag_array
return tag_instance unless tag_instance.nil?
tag_instance = ContextTag.new(tag)
tag_instance = (@known_tags[tag_instance] ||= tag_instance)
@known_tags[tag] ||= tag_instance
@known_tags[tag_instance.tag] ||= tag_instance
end
@tag ||= @tag_array.join('_').to_sym
tag_data = {
tag: @tag,
array: @ŧag_array
}
@@known_tags[@tag] ||= tag_data
@@known_tags[tag] ||= tag_data
end
def initialize(tag)
process_tag(tag)
end
private def process_tag(tag)
case tag
when Symbol, String
@taglist = tag.to_s.split('_').uniq.sort
when Array
@taglist = tag.map(&:to_s).uniq.sort
end
@tag = @taglist.join('_').to_sym
@taghash = {}
@taglist.each do |tag|
@taghash[tag] = true
end
end
def include?(*tags)
tags = tags - @tag_array
tags.empy?
end
alias include_all? include?
def include_any?(*tags)
tags = tags & @tag_array
tags.empty?
end
def hash
@tag.hash
end
def eql?(other)
if(other.is_a? Symbol)
@tag.eql? other
elsif(other.is_a? ContextTag)
@tag.eql? other.tag
end
end
end
#

View file

@ -1,6 +1,8 @@
require_relative 'artefact_engine.rb'
require_relative 'context.rb'
module Comfpile
class Core
attr_reader :processing_stack