This guide is for those who want to understand the general organization of the code, and possibly contribute. See the Getting Started guide for how to get the code building.
Framework Overview
- [1] Benchmark corresponds to a C file in a subdirectory of
benchmarks
. - [2] CGRA Architecture Description corresponds to a XML file in
architectures
. - [3] CGRA Architecture Interpreter is implemented by either
src/adl_0
orsrc/adl_1
, depending on the command line argument (1 is the default).- Additionally, the modules that are instantiated by the XML correspond to subclasses of
Module
insrc/core/Module{,RoutingStructures}.cpp
- Additionally, the modules that are instantiated by the XML correspond to subclasses of
- [4] Device Model of Architecture is set of
Modules
connected together to each other by ports, and in a tree stored inclass CGRA
.- Can also be constructed directly by the C++ API, see
inc/CGRA/user-inc/UserArch.h
for how to register a generator.
- Can also be constructed directly by the C++ API, see
[5] LLVM is the C-to-DFG pass, source is in
llvm-passes/DFG
.- produces a file in the DOT format that describes the DFG, read into main
cgrame
executable as aclass OpGraph
.
- produces a file in the DOT format that describes the DFG, read into main
[6] Mapper is one of three mappers: (Xander's)
ILPMapper
, (Xander's)AnnealMapper
, or (Matthew's)ILPHeuristicMapper
, depending on command-line arguments- takes a
CGRA
and aOpGraph
and produces aclass Mapping
. - At map time, device model (
CGRA
) is converted toclass MRRG
. Each module produces a fragment and they're stitched together by the connections between ports. - Mappers are in
core/{ILPMapper,AnnealMapper,HeuristicMapper}.cpp
- takes a
- [7] Verilog RTL for CGRA is the Verilog produced by calling
CGRA::genVerilog
. Uses CoreIR based approach by default. - [8] Verilog Simulation can be done with the "configurator" module produced by calling
printTestbench
onCGRA::genBitStream
. Seeverilog-verif
folder for an automated approach. - [9] & [A] are not directly part of the repository, and done by feeding the generated Verilog into the relevant ASIC or FPGA tool.
- [B] & [C] are files in
performance_models
. - [D] Performance/Power/Area Estimation engine is implemented by
src/perfengine
.
- [B] & [C] are files in
If you want to understand the flows, a good place to start reading is
cgrame
'smain
function insrc/run/cgrame.cpp
.
Repository Layout
A freshly cloned repository contains the following directories:
arch
-- XML architecture description language (ADL) filessimple/*.xml
-- ADL v0 architecturessimple/archfiles/*.xml
-- ADL v1 architectures
benchmarks
-- benchmark C code and Makefiles to build themcmake
-- some files usid by the CMake when the code is builtdoc
-- documentationinc
-- header files that are part of the APIperformance_models
-- models/configuration for the performance enginesrc
-- source files and internal header files (src details)thirdparty
-- any code that we didn't write (thirdparty details)verilog-verif
-- files for automatic generation and testing of generated Verilog implementations
After building, the following will be present
builds
-- directory for builds. Subdirectories include (depending on builds done)release
anddebug
build
-- symlink to the most recently built subdirectory ofbuilds
After running, the following may be present
output
-- location of the visualization.
Src Details
adl_0
-- the first version of the ADLadl_1
-- the second version of the ADLarchs
-- C++ architecture creation code, with architecture-specific modules (eg. HyCUBE, ADRES, and their special PEs)core
-- common types, algorithms and the mappersdotparser
-- DOT parser, used for reading OpGraphs and mappingllvm-passes
-- LLVM passes, including the C-to-DFG passmodules
-- common modules; modules that aren't architecture specificperfengine
-- implementation of the performance enginerun
--main
functions, and associated filesvisual
-- visualization and related files
Thirdparty Details
catch2
-- the testing library, Catch2coreir
-- our fork of the CoreIR project, used for Verilog generation (submodule)cxxopts
-- CXXOpts, a command line option parsergoogle-or-tools
-- Google's operation research tools library (submodule)mINI
-- An INI parser, used to readmapper_config.ini
pugixml
-- pugixml XML parser, used to read the XML architecturesscipoptsuite
-- Solving Constraint Integer Programs, an ILP solvertatum
-- the Tatum static timing analysis library, used by the performance engine. (submodule)vis
-- vis.js, used for the visualization