Skip to content

Commit 541b74a

Browse files
committed
[Yosyslib]: add README to the yosyslib directory
Signed-off-by: Seyed Alireza Damghani <[email protected]>
1 parent 5172401 commit 541b74a

File tree

10 files changed

+99
-1
lines changed

10 files changed

+99
-1
lines changed

vtr_flow/misc/yosyslib/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Yosys+VTR library files
2+
This directory includes required Verilog models to run the VTR flow using Yosys as its front-end.
3+
The approach of utilizing Yosys as the VTR synthesizer is mainly driven by what Eddie Hung proposed
4+
for the [`VTR-to-Bitstream`](http://eddiehung.github.io/vtb.html) (VTB), based upon VTR 7. Although
5+
some files, such as [`yosys_models.v`](./yosys_models.v) and [`multiply.v`](./multiply.v), are directly
6+
copied from the VTB project, the other files have been subjected to a few changes due to significant
7+
alterations from VTR 7 to the current version of VTR. Furthermore, Hung's approach was specifically
8+
proposed for Xilinx Vertix-6 architecture. As a result, we have applied relevant changes to the remainder
9+
of Yosys library files to make them compatible with the current VTR version and support routine architectures
10+
used in the VTR regression tests.
11+
12+
## What is new compared to the VTB files?
13+
Changes applied to the VTB files are outlined as follows:
14+
1. Replacing Vertix-6 adder black-box (`xadder`) with the conventional adder used in the current version of VTR.
15+
2. If required, performing a recursive depth splitting for memory hard blocks, i.e., `single_port_ram` and `dual_port_ram`, to make them adaptable with the VTR flow configurations.
16+
3. Converting asynchronous DFFs with enable signals (ADFFE) to synchronous form using [`adffe2dffe.v`](./../../../ODIN_II/techlib/adffe2dff.v).
17+
4. Adding `dffunmap` to transform complex DFF sub-circuits, such as SDFFE (DFF with synchronous reset and enable), to their soft logic implementation, i.e., the combination of multiplexers and latches.
18+
5. Removing the ABC commands from the Yosys synthesis script and letting the VTR flow's ABC stage performs the technology mapping. (NOTE: the LUT size is considered the one defined in the architecture file as the same as the regular VTR flow)
19+
20+
## How to add new changes?
21+
The Yosys synthesis commands, including the generic synthesis and additional VTR specific configurations, are provided
22+
in [`synthesis.ys`](./synthesis.ys). To make changes in the overall Yosys synthesis flow, the [`synthesis.ys`](./synthesis.ys)
23+
script is perhaps the first file developers may require to change.
24+
25+
Moreover, the [`yosys_models.v`](./yosys_models.v) file includes the required definitions for Yosys to how it should infer implicit
26+
memories and instantiate arithmetic operations, such as addition, subtraction, and multiplication. Therefore, to alter these
27+
behaviours or add more regulations such as how Yosys should behave when facing other arithmetic operations, for example modulo and division,
28+
the [`yosys_models.v`](./yosys_models.v) Verilog file is required to be modified.
29+
30+
Except for [`single_port_ram.v`](./single_port_ram.v) and [`dual_port_ram.v`](./dual_port_ram.v) Verilog files that perform the depth splitting
31+
process, the other files are defined as black-box, i.e., their declarations are required while no definition is needed. To add new black-box
32+
components, developers should first provide the corresponding Verilog files similar to the [`adder.v`](./adder.v). Then, a new `read_verilog -lib TTT/NEW_BB.v`
33+
command should be added to the Yosys synthesis script. If there is an implicit inference of the new black-box component, the [`yosys_models.v`](./yosys_models.v)
34+
Verilog file must also be modified, as mentioned earlier.

vtr_flow/misc/yosyslib/adder.v

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/********************************************************
2+
# Description: definition of the hard adder black-box #
3+
# #
4+
# Author: Seyed Alireza Damghani ([email protected]) #
5+
********************************************************/
6+
17
(* blackbox *)
28
module adder(a, b, cin, cout, sumout);
39
input a, b, cin;

vtr_flow/misc/yosyslib/dpram_rename.v

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/******************************************************************
2+
# Description: Renaming depth-split dualPortRam to dual_port_ram #
3+
# to be recognized by VTR flow CAD tools. This file #
4+
# is executed by the Yosys synthesis flow once the #
5+
# dual_port_ram.v is executed. #
6+
# #
7+
# Author: Seyed Alireza Damghani ([email protected]) #
8+
******************************************************************/
9+
10+
111
`timescale 1ps/1ps
212

313
`define MEM_MAXADDR PPP

vtr_flow/misc/yosyslib/dual_port_ram.v

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/****************************************************************
2+
# Description: Performing a recursive depth splitting for #
3+
# dual_port_ram memory hard blocks #
4+
# #
5+
# Author: Seyed Alireza Damghani ([email protected]) #
6+
****************************************************************/
7+
18
`timescale 1ps/1ps
29

310
`define MEM_MAXADDR PPP

vtr_flow/misc/yosyslib/multiply.v

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/****************************************************************
2+
# Description: definition of the hard multiplier black-box #
3+
# #
4+
# Author: Eddie Hung #
5+
# VTR-to-Bitstream: "http://eddiehung.github.io/vtb.html" #
6+
****************************************************************/
7+
18
(* blackbox *)
29
module multiply(a, b, out);
310
parameter A_WIDTH = 36;

vtr_flow/misc/yosyslib/single_port_ram.v

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/****************************************************************
2+
# Description: Performing a recursive depth splitting for #
3+
# single_port_ram memory hard blocks #
4+
# #
5+
# Author: Seyed Alireza Damghani ([email protected]) #
6+
****************************************************************/
7+
18
`timescale 1ps/1ps
29

310
`define MEM_MAXADDR PPP

vtr_flow/misc/yosyslib/spram_rename.v

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*********************************************************************
2+
# Description: Renaming depth-split singlePortRam to single_port_ram #
3+
# to be recognized by VTR flow CAD tools. This file #
4+
# is executed by the Yosys synthesis flow once the #
5+
# single_port_ram.v is executed. #
6+
# #
7+
# Author: Seyed Alireza Damghani ([email protected]) #
8+
*********************************************************************/
9+
110
`timescale 1ps/1ps
211

312
`define MEM_MAXADDR PPP

vtr_flow/misc/synthesis.ys renamed to vtr_flow/misc/yosyslib/synthesis.ys

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
# it adaptable with the current VTR flow have been made. #
1010
# #
1111
# [1] http://eddiehung.github.io/vtb.html #
12+
# #
13+
# Author: Eddie Hung #
14+
# Co-author: Seyed Alireza Damghani ([email protected]) #
1215
#################################################################
1316

1417
# XXX (input circuit) is replaced with filename by the run_vtr_flow script

vtr_flow/misc/yosyslib/yosys_models.v

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/********************************************************************************************
2+
# Description: this file includes the required definitions for Yosys to how it should #
3+
# infer implicit memories and instantiate arithmetic operations, such as #
4+
# addition, subtraction, and multiplication. In this file, implicit memory #
5+
# boundary and required splitting process, arithmetic operation depth/width #
6+
# splitting, and error handling for possible invalid situations are specified. #
7+
# #
8+
# NOTE: PPP, AAA, and MMM will be replaced with the configuration specifications via the #
9+
# run_vtr_flow.py script file while the VTR flow is executing. #
10+
# #
11+
# Author: Eddie Hung #
12+
# VTR-to-Bitstream: "http://eddiehung.github.io/vtb.html" #
13+
********************************************************************************************/
14+
15+
116
`define MEM_MINWIDTH 1
217
`define MEM_MAXADDR PPP
318
`define MEM_MAXDATA 36

vtr_flow/scripts/python_libs/vtr/paths.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
# YOSYS paths
2020
yosys_exe_path = root_path / "libs" / "EXTERNAL" / "libyosys" / "yosys"
21-
yosys_script_path = vtr_flow_path / "misc" / "synthesis.ys"
2221
yosys_lib_path = vtr_flow_path / "misc" / "yosyslib"
22+
yosys_script_path = yosys_lib_path / "synthesis.ys"
2323

2424
# ABC paths
2525
abc_path = root_path / "abc"

0 commit comments

Comments
 (0)