94 lines
No EOL
2.8 KiB
Ruby
94 lines
No EOL
2.8 KiB
Ruby
|
|
|
|
$core.add_artefact_engine Comfpile::ParserEngine,
|
|
file_regex: /^(.+)\.vhd$/,
|
|
search_regexes: [
|
|
{
|
|
regex: /--+\s*comf\.(?<key>[^:]+)[=:]\s*(?<value>.+)/
|
|
}
|
|
]
|
|
|
|
$core.add_artefact_engine do |engine|
|
|
engine.add_recipe(:ghdl_analysed, /^(.+)\.vhd/) do |match, a|
|
|
a.parent_artefact :dependency_analysis_include, a.target
|
|
|
|
a.add_step do
|
|
@parent_artefact.dependencies.each do |dependency|
|
|
next if dependency.target == a.target
|
|
|
|
log "Adding dependency for ghdl analysis of #{dependency.target}..."
|
|
|
|
require_artefact :ghdl_analysed, dependency.target
|
|
end
|
|
end
|
|
|
|
a.add_step do
|
|
work_library = find_parsed_parameter('vhdl.work')
|
|
if work_library.nil?
|
|
work_library = ''
|
|
else
|
|
work_library = '--work=' + work_library
|
|
end
|
|
|
|
cmd = "ghdl -a -fsynopsys --std=08 #{work_library} #{self.file}"
|
|
log "Executing: #{cmd}"
|
|
|
|
`#{cmd}`
|
|
end
|
|
end
|
|
|
|
engine.add_recipe(:ghdl_elaborated, /^(.+)\.vhd/) do |match, a|
|
|
a.parent_artefact :dependency_analysis, a.target
|
|
|
|
a.add_step do
|
|
dependencies.each do |dep|
|
|
require_artefact :ghdl_analysed, dep.target
|
|
end
|
|
end
|
|
|
|
a.add_step do
|
|
work_library = find_parsed_parameter('vhdl.work')
|
|
if work_library.nil?
|
|
work_library = ''
|
|
else
|
|
work_library = '--work=' + work_library
|
|
end
|
|
|
|
elaborate_arch = find_parsed_parameter('vhdl.elaborate') || File.basename(@target).chomp(File.extname(@target))
|
|
|
|
cmd = "ghdl -e -fsynopsys --std=08 #{work_library} #{elaborate_arch}"
|
|
log "Executing: #{cmd}"
|
|
|
|
`#{cmd}`
|
|
end
|
|
end
|
|
|
|
engine.add_recipe :ghdl_run, /^(.+)\.vhd/ do |match, a|
|
|
a.parent_artefact :ghdl_elaborated, a.target
|
|
|
|
a.add_step do
|
|
work_library = find_parsed_parameter('vhdl.work')
|
|
if work_library.nil?
|
|
work_library = ''
|
|
else
|
|
work_library = '--work=' + work_library
|
|
end
|
|
|
|
elaborate_arch = find_parsed_parameter('vhdl.elaborate') || File.basename(@target).chomp(File.extname(@target))
|
|
|
|
@parameters[:ghdl_arch] = elaborate_arch
|
|
|
|
cmd = "ghdl -r -fsynopsys --std=08 #{work_library} #{elaborate_arch} --wave=#{elaborate_arch}.ghw"
|
|
log "Executing: #{cmd}"
|
|
|
|
`#{cmd}`
|
|
end
|
|
end
|
|
|
|
engine.add_recipe(:gtkwave_output, /^(.+)\.vhd/) do |match, a|
|
|
a.parent_artefact :ghdl_run, a.target
|
|
a.add_step do
|
|
`gtkwave #{@parent_artefact[:ghdl_arch]}.ghw`
|
|
end
|
|
end
|
|
end |