<commit_before><commit_msg>Added a script for applying the Alliance tool set down to techonology mapping on HDLRbuy compiling results.<commit_after>#!/usr/bin/ruby

require 'fileutils'


##
# Front-end to the Alliance tool chain for hdrcc vhdl results
##############################################################


######################################################
# Initialization phase
#
# Process the options.
# For now there should only be the name of the main file.
$input = $*[0]

# Get the extension name, the base name and the path from the main file.
$extname  = File.extname($input)
$basename = File.basename($input,$extname)
$path     = File.dirname($input)
$fullname = $basename + $extname

# Go the the target directory.
Dir.chdir($path)

# Gather the files other than the main to treat.
$subfiles = Dir.foreach("./").select do |name|
    File.extname(name) == $extname && name != $fullname
end
# And the all files to treat.
$allfiles = [$fullname] + $subfiles

# Generate the base names for the sub files.
$subbases = $subfiles.map {|file|  File.basename(file,$extname) }
$subbases =[ $basename + "_model" ] + $subbases

######################################################
# Compiling steps

# Conversion to alliance format.
$allfiles.each do |file|
    cmd = "vasy -Vaop -I vhd #{file}"
    puts cmd
    `#{cmd}`
end

# Boolean minimisation.
$subbases.each do |base|
    cmd = "boom -l 3 -d 50 #{base}.vbe"
    puts cmd
    `#{cmd}`
end

# Structureal description generation.
$subbases.each do |base|
    cmd = "boog #{base}_o #{base} -x 1 -m 2"
    puts cmd
    `#{cmd}`
end

# Flattening and global optimization.
cmd = "loon #{$basename} #{$basename}_l -x 0 -m 0"
puts cmd
`#{cmd}`

# Placement.
cmd = "ocp #{$basename}_l #{$basename}_p"
puts cmd
`#{cmd}`

# Route.
cmd = "nero -V -p #{$basename}_p #{$basename}_l #{$basename}_r"
puts cmd
`#{cmd}`

# Technology mapping.
cmd = "s2r -v #{$basename}_r #{$basename}_core"
puts cmd
`#{cmd}`


## Other tools
#  
#  Simulation:
#  `asimut #{$basename}_l #{$basename}_in #{$basename}_out`
#
#  View simulation result:
#  `xpat -l #{basename}_out`
#
#  View P&R result:
#  `graal`
#
#  Extract netlist:
#  `cougar #{$basename}_r #{$basename}_c`
#
#  Check P&R result:
#  `lvx vst al #{$basename} #{$basename}_c` or
#  `lvx vst vst #{$basename} #{$basename}_c`
#
#  DRC check:
#  `druc #{$basename}_r`
#
#  View techno mapping result:
#  `dreal -l #{$basename}_core`
#

{'fraction_non_alphanumeric': 0.21944216570959804, 'fraction_numerical': 0.0036915504511894994, 'mean_word_length': 4.245161290322581, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1505252', 'n_tokens_mistral': 892, 'n_tokens_neox': 887, 'n_words': 264}