Commit dbfa9a74 authored by Théotime BOLLENGIER's avatar Théotime BOLLENGIER
Browse files

help upside down

parent 55d57ab4
......@@ -60,6 +60,7 @@ Gem::Specification.new do |s|
'bin/vpr_7.0',
'share/bin/config_shuffling.rb',
'share/bin/constraint_io_locations.rb',
'share/bin/gen_makefile.rb',
'share/bin/hdl_arch_writer.rb',
'share/bin/high_level_arch_generator.rb',
'share/bin/ide.rb',
......
......@@ -39,7 +39,7 @@ STDERR.sync = true
options = {}
optparse = OptionParser.new do |opts|
opts.banner = "Usage: #{File.basename($0)} [options]"
opts.banner = "Usage: argen #{File.basename($0, '.*')} [options]"
options[:par] = nil
opts.on('-i', '--input FILE', 'Placement and routing input file') do |s|
......
......@@ -41,7 +41,7 @@ STDERR.sync = true
options = {}
optparse = OptionParser.new do |opts|
opts.banner = "Usage: #{File.basename($0)} [options]"
opts.banner = "Usage: argen #{File.basename($0, '.*')} [options]"
options[:par] = nil
opts.on('-i', '--input FILE', 'Placement and routing input file') do |s|
......
......@@ -41,7 +41,7 @@ options = {}
optparse = OptionParser.new do |opts|
# Set a banner, displayed at the top
# of the help screen.
opts.banner = "Usage: #{File.basename($0)} [options] -i <input_bitstream_file> -k <key> -o <output_shuffled_bitstream_file>"
opts.banner = "Usage: argen #{File.basename($0, '.*')} [options] -i <input_bitstream_file> -k <key> -o <output_shuffled_bitstream_file>"
options[:inputFile] = nil
opts.on('-i', '--input FILE', 'Input bitstream file (unciphered)') do |file|
......
......@@ -38,7 +38,7 @@ STDERR.sync = true
options = {}
optparse = OptionParser.new do |opts|
opts.banner = "Usage: #{File.basename($0)} [options]"
opts.banner = "Usage: argen #{File.basename($0, '.*')} [options]"
options[:arch] = nil
opts.on('--arch FILE', 'Input ArGen architecture description file') do |s|
......
# Copyright (C) 2020 ENSTA Bretagne
# Author: Théotime Bollengier <theotime.bollengier@ensta-bretagne.fr>
#
# This file is part of ArGen. <https://gitlab.ensta-bretagne.fr/argen/argen>
#
# ArGen is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ArGen is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ArGen. If not, see <http://www.gnu.org/licenses/>.
require 'optparse'
require_relative '../../lib/argen/version.rb'
$copyright = "Copyright (C) 2020 ENSTA Bretagne"
$authors = [
["Théotime Bollengier", "<theotime.bollengier@ensta-bretagne.fr>"]
]
$program_name = File.basename(__FILE__, '.*')
$program_version = ArGen::VERSION
$description = "This program generates makefile templates to setup an ArGen flow."
$description_string = "Welcome to #{$program_name} #{$program_version}, a component of the ArGen framework.\n#{$description}\n#{$copyright}\n#{$authors.collect.with_index{|a, i| "#{(i == 0) ? "Author#{($authors.length > 1) ? 's':''}: " : " #{($authors.length > 1) ? ' ':''} "}#{a.first} #{a.last}\n"}.join}\n"
STDOUT.sync = true
STDERR.sync = true
options = {}
optparse = OptionParser.new do |opts|
opts.banner = "Usage: argen #{File.basename($0, '.*')} [options]"
options[:output] = nil
opts.on('-o', '--output [FILE]', 'Name of the output Makefile (defaults to Makefile)') do |s|
if s.is_a?(String) then
options[:output] = s
else
options[:output] = true
end
end
options[:overwrite] = false
opts.on('-w', '--overwrite', 'If the output file already exists, overwrite it') do
options[:overwrite] = true
end
opts.on('-h', '--help', 'Display this help') do
puts $description_string
puts opts
puts
exit
end
end
begin
optparse.parse!
rescue Exception => e
if e.class == SystemExit then
exit 0
else
abort e.message + "\n" + optparse.to_s
end
end
STDERR.puts "WARNING: Unused commandline arguments: #{ARGV.join(' ')}" unless ARGV.empty?
if options[:output] then
options[:output] = 'Makefile' unless options[:output].is_a?(String)
options[:output] = File.expand_path(options[:output])
if File.exist?(options[:output]) then
abort "ERROR: \"#{options[:output]}\" already exists and is a directory" unless File.file?(options[:output])
abort "ERROR: \"#{options[:output]}\" already exists" unless options[:overwrite]
end
ofile = File.open(options[:output], 'w')
else
ofile = $stdout
end
ofile.puts <<EndOfString
# Makefile generated by ArGen v#{ArGen::VERSION} on #{Time.now.strftime('%A %-d %B %Y at %H:%M:%S')}
# https://gitlab.ensta-bretagne.fr/argen/argen
# Architecture definition
ARCH_WIDTH ?= 4 # Number of CLB per row
ARCH_HEIGHT ?= 4 # Number of CLB per column
ARCH_WIRES ?= 12 # Number of unidirectionnal routing tracks per routing channel (must be multiple of 2)
ARCH_N ?= 4 # Number of BLE per CLB
ARCH_K ?= 4 # Number of BLE per CLB
ARCH_I ?= $(shell echo '($(ARCH_K)*($(ARCH_N)+1))/2' | bc) # Number of inputs per CLB
ARCH_FCI ?= 0.25 # CLB input connection flexibility
ARCH_FCO ?= 0.50 # CLB output connection flexibility
ARCH_IOPB ?= 1 # Number of IO per IO block
ARCH_IOFCI ?= 0.50 # IO input connection flexibility
ARCH_IOFCO ?= 0.50 # IO output connection flexibility
# Graphics
IMAGE_EXTENSION ?= png
IMAGE_MAX_WIDTH ?= 1920
IMAGE_MAX_HEIGHT ?= 1080
IMAGE_USE_DARK_THEME ?= true
IMAGE_PRINT_TILES ?= false
IMAGE_SHOW_DFLT_ROUTES ?= false
# Logic synthesis
SYNTH_MINIMIZE_AREA ?= false # Minimize area (instead of logic level)
SYNTH_SWEEP ?= false # Sweep netlist (remove dangling nodes, etc)
SYNTH_RETIME ?= false # Retime netlist
SYNTH_LCORR ?= false # Compute latch correspondence
SYNTH_ZLATCH ?= false # set latches initial value to zero
# Files
ARCHITECTURE_NAME ?= arch
ARGEN_ARCHITECTURE ?= $(ARCHITECTURE_NAME).argen
VPR_ARCHITECTURE ?= $(ARCHITECTURE_NAME).xml
ARCHITECTURE_IMAGE ?= $(ARCHITECTURE_NAME).$(IMAGE_EXTENSION)
APP_SRC ?= $(wildcard *.piccolo)
APP_CONSTRAINTS ?= $(wildcard *.iocf)
NETLIST_NAME ?= netlist
APP_NETLIST ?= $(NETLIST_NAME).blif
APP_NETLIST_MAPPED_ABC ?= $(NETLIST_NAME)_mapped_abc.blif
APP_NETLIST_MAPPED ?= $(NETLIST_NAME)_mapped.blif
APP_PACKING ?= $(NETLIST_NAME)_packing.net
APP_PLACEMENT ?= $(NETLIST_NAME)_placement.place
APP_ROUTING ?= $(NETLIST_NAME)_routing.route
APP_PACKING_REPACKED ?= $(NETLIST_NAME)_packing_repacked.net
APP_IO_PLACEMENT ?= $(NETLIST_NAME)_IO_placement.place
APP_PLACEMENT_REPLACED ?= $(NETLIST_NAME)_placement_replaced.place
APP_PAR ?= $(NETLIST_NAME).par
APP_PAR_IMAGE ?= $(NETLIST_NAME)_par.$(IMAGE_EXTENSION)
# VPR Packer options
VPR_PACKER_CONNECTION_DRIVEN_CLUSTERING ?= on # default: on
VPR_PACKER_TIMING_DRIVEN_CLUSTERING ?= on # default: on
VPR_PACKER_ALLOW_UNRELATED_CLUSTERING ?= on # default: on
VPR_PACKER_ALPHA_CLUSTERING ?= 0.75 # default: 0.75
VPR_PACKER_BETA_CLUSTERING ?= 0.90 # default: 0.90
# VPR Placer options
VPR_PLACER_ALGORITHM ?= path_timing_driven # bounding_box, net_timing_driven or path_timing_driven
VPR_PLACER_TIMING_TRADEOFF ?= 0.5 # Valid only for timing driven placement, default: 0.5
VPR_PLACER_RANDOM_SEED ?= 1
VPR_PLACER_INNER_NUMBER ?= 10 # speed/quality placement tradeoff, default: 10
# VPR Router options
VPR_ROUTER_MAX_ITERATIONS ?= 200 # default: 50
VPR_ROUTER_BB_FACTOR ?= 10 # default: 3
VPR_ROUTER_ALGORITHM ?= timing_driven # breadth_first or timing_driven
################################################################################
ifneq (,$(findstring true, $(IMAGE_USE_DARK_THEME)))
DARK_THEME := --dark
endif
ifneq (,$(findstring true, $(IMAGE_PRINT_TILES)))
P_TILES := --tiles
endif
ifneq (,$(findstring true, $(IMAGE_SHOW_DFLT_ROUTES)))
IMAGE_SHOW_DFLT_ROUTES := --show_default_routes
else
IMAGE_SHOW_DFLT_ROUTES :=
endif
ifneq (,$(findstring true, $(SYNTH_MINIMIZE_AREA)))
ABC_AREA := --area
endif
ifneq (,$(findstring true, $(SYNTH_SWEEP)))
ABC_SWEEP := --sweep
endif
ifneq (,$(findstring true, $(SYNTH_RETIME)))
ABC_RETIME := --retime
endif
ifneq (,$(findstring true, $(SYNTH_LCORR)))
ABC_LCORR := --lcorr
endif
ifneq (,$(findstring true, $(SYNTH_ZLATCH)))
ABC_ZERO := --zero
endif
ifneq (,$(findstring bounding_box, $(VPR_PLACER_ALGORITHM)))
VPR_PLACER_TIMING_TRADEOFF :=
else
VPR_PLACER_TIMING_TRADEOFF := --timing_tradeoff $(VPR_PLACER_TIMING_TRADEOFF)
endif
################################################################################
all: $(ARCHITECTURE_IMAGE) $(APP_PAR_IMAGE)
view_arch: $(ARCHITECTURE_IMAGE)
eom $< &
view_par: $(APP_PAR_IMAGE)
eom $< &
$(ARGEN_ARCHITECTURE) $(VPR_ARCHITECTURE): Makefile
argen high_level_arch_generator \\
--width $(ARCH_WIDTH) --height $(ARCH_HEIGHT) \\
--wire_cardinality $(ARCH_WIRES) --cluster_size $(ARCH_N) \\
--cluster_inputs $(ARCH_I) --lut_inputs $(ARCH_K) --fcin $(ARCH_FCI) \\
--fcout $(ARCH_FCO) --IO_per_block $(ARCH_IOPB) --IOfcin $(ARCH_IOFCI) \\
--IOfcout $(ARCH_IOFCO) \\
--argen_arch $(ARGEN_ARCHITECTURE) --vpr_arch $(VPR_ARCHITECTURE)
$(ARCHITECTURE_IMAGE): $(ARGEN_ARCHITECTURE)
argen resources_to_svg $(DARK_THEME) $(P_TILES) \\
--max_width $(IMAGE_MAX_WIDTH) --max_height $(IMAGE_MAX_HEIGHT) \\
--architecture $< --output $@
$(APP_NETLIST): $(APP_SRC)
piccolo --blif $@ --optimisation opt --flatten --analyze --input $^
$(APP_NETLIST_MAPPED_ABC): $(APP_NETLIST)
ruby_abc $(ABC_AREA) $(ABC_SWEEP) $(ABC_RETIME) $(ABC_LCORR) $(ABC_ZERO) \\
--input $< --output $@ --lut_inputs $(ARCH_K)
$(APP_NETLIST_MAPPED): $(APP_NETLIST_MAPPED_ABC)
blifutils --input $< --output $@ --analyze \\
--default-latch-type re --default-latch-clock _clk_ \\
--default-latch-initial-value 0
$(APP_PACKING): $(VPR_ARCHITECTURE) $(APP_NETLIST_MAPPED)
vpr_7.0 $(VPR_ARCHITECTURE) $(APP_NETLIST_MAPPED) --nodisp --pack --net_file $(APP_PACKING) \\
--connection_driven_clustering $(VPR_PACKER_CONNECTION_DRIVEN_CLUSTERING) \\
--allow_unrelated_clustering $(VPR_PACKER_ALLOW_UNRELATED_CLUSTERING) \\
--timing_driven_clustering $(VPR_PACKER_TIMING_DRIVEN_CLUSTERING) \\
--alpha_clustering $(VPR_PACKER_ALPHA_CLUSTERING) \\
--beta_clustering $(VPR_PACKER_BETA_CLUSTERING)
$(APP_PACKING_REPACKED) $(APP_IO_PLACEMENT): $(APP_PACKING) $(ARGEN_ARCHITECTURE) $(APP_CONSTRAINTS)
argen constraint_io_locations --arch $(ARGEN_ARCHITECTURE) \\
--constraint $(APP_CONSTRAINTS) --packing_in $(APP_PACKING) \\
--packing_out $(APP_PACKING_REPACKED) \\
--placement_out $(APP_IO_PLACEMENT)
$(APP_PLACEMENT): $(VPR_ARCHITECTURE) $(APP_NETLIST_MAPPED) $(APP_PACKING_REPACKED) $(APP_IO_PLACEMENT)
vpr_7.0 $(VPR_ARCHITECTURE) $(APP_NETLIST_MAPPED) --nodisp --place \\
--net_file $(APP_PACKING_REPACKED) --place_file $(APP_PLACEMENT) \\
--fix_pins $(APP_IO_PLACEMENT) --seed $(VPR_PLACER_RANDOM_SEED) \\
--inner_num $(VPR_PLACER_INNER_NUMBER) --place_algorithm $(VPR_PLACER_ALGORITHM) $(VPR_PLACER_TIMING_TRADEOFF)
$(APP_PLACEMENT_REPLACED): $(APP_PLACEMENT) $(APP_IO_PLACEMENT)
argen rewrite_placement_with_IO_locations --input_placement $(APP_PLACEMENT) \\
--io_placement $(APP_IO_PLACEMENT) --output_placement $(APP_PLACEMENT_REPLACED)
$(APP_ROUTING): $(VPR_ARCHITECTURE) $(APP_NETLIST_MAPPED) $(APP_PACKING_REPACKED) $(APP_PLACEMENT_REPLACED)
vpr_7.0 $(VPR_ARCHITECTURE) $(APP_NETLIST_MAPPED) --nodisp --route \\
--net_file $(APP_PACKING_REPACKED) --place_file $(APP_PLACEMENT_REPLACED) \\
--route_file $(APP_ROUTING) --route_chan_width $(ARCH_WIRES) \\
--max_router_iterations $(VPR_ROUTER_MAX_ITERATIONS) \\
--bb_factor $(VPR_ROUTER_BB_FACTOR) --router_algorithm $(VPR_ROUTER_ALGORITHM)
$(APP_PAR): $(ARGEN_ARCHITECTURE) $(APP_NETLIST_MAPPED) $(APP_PACKING_REPACKED) $(APP_PLACEMENT_REPLACED) $(APP_ROUTING)
argen vpr_par_reader --architecture $(ARGEN_ARCHITECTURE) --netlist $(APP_NETLIST_MAPPED) \\
--packing $(APP_PACKING_REPACKED) --placement $(APP_PLACEMENT_REPLACED) \\
--routing $(APP_ROUTING) --output $(APP_PAR)
$(APP_PAR_IMAGE): $(APP_PAR)
argen place_and_route_viewer $(DARK_THEME) $(P_TILES) $(IMAGE_SHOW_DFLT_ROUTES) \\
--max_width $(IMAGE_MAX_WIDTH) --max_height $(IMAGE_MAX_HEIGHT) \\
--input $< --output $@
clean:
@rm -vf $(ARGEN_ARCHITECTURE)
@rm -vf $(VPR_ARCHITECTURE)
@rm -vf $(ARCHITECTURE_IMAGE)
@rm -vf $(APP_NETLIST)
@rm -vf $(APP_NETLIST_MAPPED_ABC)
@rm -vf $(APP_NETLIST_MAPPED)
@rm -vf $(APP_PACKING)
@rm -vf $(APP_PACKING_REPACKED)
@rm -vf $(APP_PLACEMENT)
@rm -vf $(APP_PLACEMENT_REPLACED)
@rm -vf $(APP_IO_PLACEMENT)
@rm -vf $(APP_ROUTING)
@rm -vf $(APP_PAR)
@rm -vf $(APP_PAR_IMAGE)
@rm -vf *.criticality.out
@rm -vf *.critical_path.out
@rm -vf *.slack.out
@rm -vf vpr_stdout.log
.PHONY: clean view_arch view_par
EndOfString
ofile.close if options[:output]
......@@ -43,7 +43,7 @@ options = {}
optparse = OptionParser.new do |opts|
# Set a banner, displayed at the top
# of the help screen.
opts.banner = "Usage: #{File.basename($0)} [options] -i arch_file -o output_vhdl_vild"
opts.banner = "Usage: argen #{File.basename($0, '.*')} [options] -i arch_file -o output_vhdl_vild"
options[:archFile] = nil
opts.on('-i', '--input FILES', 'Architecture input file') do |file|
......
......@@ -51,7 +51,7 @@ options = {}
optparse = OptionParser.new do |opts|
# Set a banner, displayed at the top
# of the help screen.
opts.banner = "Usage: #{File.basename($0)} [options]"
opts.banner = "Usage: argen #{File.basename($0, '.*')} [options]"
options[:width] = 3
opts.on('-w', '--width INTEGER', Integer, 'Width of the CLB matrix') do |i|
......
......@@ -41,7 +41,7 @@ STDERR.sync = true
options = {}
optparse = OptionParser.new do |opts|
opts.banner = "Usage: #{File.basename($0)} [options]"
opts.banner = "Usage: argen #{File.basename($0, '.*')} [options]"
options[:par] = nil
opts.on('-i', '--input FILE', 'Placement and routing input file') do |s|
......
......@@ -41,7 +41,7 @@ STDERR.sync = true
options = {}
optparse = OptionParser.new do |opts|
opts.banner = "Usage: #{File.basename($0)} [options]"
opts.banner = "Usage: argen #{File.basename($0, '.*')} [options]"
options[:par] = nil
opts.on('-i', '--input FILE', 'Placement and routing input file') do |s|
......
......@@ -40,7 +40,7 @@ STDERR.sync = true
options = {}
optparse = OptionParser.new do |opts|
opts.banner = "Usage: #{File.basename($0)} [options]"
opts.banner = "Usage: argen #{File.basename($0, '.*')} [options]"
options[:arch] = nil
opts.on('-a', '--architecture FILE', 'ArGen architecture input file') do |s|
......
......@@ -38,7 +38,7 @@ STDERR.sync = true
options = {}
optparse = OptionParser.new do |opts|
opts.banner = "Usage: #{File.basename($0)} [options]"
opts.banner = "Usage: argen #{File.basename($0, '.*')} [options]"
options[:input_p] = nil
opts.on('-i', '--input_placement FILE', 'Placement input file') do |s|
......
......@@ -40,7 +40,7 @@ STDERR.sync = true
options = {}
optparse = OptionParser.new do |opts|
opts.banner = "Usage: #{File.basename($0)} [options]"
opts.banner = "Usage: argen #{File.basename($0, '.*')} [options]"
options[:par] = nil
opts.on('-p', '--par FILE', 'Placement and routing input file') do |s|
......
......@@ -36,7 +36,7 @@ $description_string = "Welcome to #{$program_name} #{$program_version}, a compon
options = {}
optparse = OptionParser.new do |opts|
opts.banner = "Usage: #{File.basename($0)} [options]"
opts.banner = "Usage: argen #{File.basename($0, '.*')} [options]"
options[:par] = nil
opts.on('-p', '--par FILE', 'Placement and routing input file') do |s|
......
......@@ -44,7 +44,7 @@ STDERR.sync = true
options = {}
optparse = OptionParser.new do |opts|
opts.banner = "Usage: #{File.basename($0)} [options]"
opts.banner = "Usage: argen #{File.basename($0, '.*')} [options]"
options[:arch] = nil
opts.on('-a', '--architecture FILE', 'ArGen architecture file') do |s|
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment