Imellal / RTL_synthesis_using_sky130

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RTL Design, Synthesis and Optimization using Yosys and SKYWATER130 PDKs

Verilog-flyer

In VLSI industry Front-end digital design inlcudes RTL design, synthesis, optimization and verification. In the current repository i have included the deisgn, synthesis and optimization work on various digital modules, from very simple digital logic (mux, decoder, encoder etc.) to complex designs(barrel shifter, booth multiplier, dual port ram etc). All the work has been done using open source tools:-

  • iverilog for RTL simulation.
  • gtkwave for reading .vcd file and waveform generation.
  • yosys for synthesis and netlist generation.
  • skywater 130nm open source pdk.

Introduction Of OPEN-SOURCE HARDWARE And TOOLS

With the introduction of open-source tools in the ASIC flow, now VLSI engineers have opportunity to design and craft their own ideas starting from RTL 2 GDSII. Moreover further inclusion of VLSI enthusiast and learners have propelled the need of open-source community for hardware also. Organizations such as:-

  • open source hardware association
  • SiFive
  • FOSSI
  • OpenPOWER Foundation
  • VSD
  • RISCV
  • Redwood EDA
  • Efabless etc

are committed to bring revolution in the Silicon industry.

RTL DESIGN AND SYNTHESIS USING SKYWATER130 PDK


I have categorized my work in day wise learning, according to the workshop conducted by VSD.


Table of Contents


DAY 01

Introduction to verilog RTL design and synthesis

RTL Design

It's a way of writng hdl code for digital design in a way to exploit the behavioral features offered by the language and also utilizing the structural description for design accuracy. So it's a trade off between behavioral constructs and structural description while writing hardware code.

Synthesis

Translation and optimization of the RTL code into the gate level netlist. The synthesis tool(yosys) takes hdl code, liberty file(.lib) and design constraints to generate gate level netlist.

Netlist

Representation of the design in terms of actual standard cells and their connections.

Lib file

Liberty Timing file(.lib) consist of timing and power parameters associated with standard cells specific to a particular technology node. Generally it includes definition of an inverter, nand2, nand3, nand4, nor2, nor3, nor4, aoi12, aoi22, oai12, oai22, mux, dff etc.

NOTE

Why Standard Cell library includes various(in terms of PPA) types of gate cells?

In the digital circuit some combinational paths requires cells that are very fast in performance(but requires more area and power) and likewise some combinational paths requires cells that are slower in performance(but better in terms of area and power). So adhering to the timing conditions, which standard cells are to be used the decision is made. These decisions are written in constraint file and are passed to synthesis tool(yosys) for guided synthesis.

Synthesis using yosys

Invoke yosys shell

   $ yosys

shubh_yosys_invoke

yosys>

Commands for synthesis using yosys

    yosys> read_liberty -lib ../../path_to_the_standard_library_file.lib         // reading the liberty file.
    yosys> read_verilog ../../path_to_verilog_file_that_is_to_be_synthesized.v   // reading the verilog file.
    yosys> synth -top module_name                                                // the module name that is to be synthesized.
    yosys> abc -liberty  ../../path_to_to_liberty_file.lib                       // netlist generation.
    yosys> show                                                                  // a gui based representation of logic synthesized.
    yosys> write_verilog file_name.v                                             // write the generated netlist to new a module/verilog
                                                                                 // file for verification.

Results

result of the command "yosys> synth -top module_name"

shubh_synth_result

  • result of the command "yosys> abc -liberty ../../path_to_liberty_file.lib" NOTE
  • the difference in synthesis performed by various version of yosys.
  • synthesis performed by yosys 0.7.

shubh_abc_result

  • logical representation of the deisgn by yosys 0.7.

shubh_show

  • synthesis performed by yosys 0.9.

shubh_abc_01

  • logical representation of the design by yosys 0.9.

shubh_show_01

NOTE

the synthesis performed by yosys 0.7 is choosing different standard cells as compared to synthesis by yosys 0.9.

  • netlist generated by yosys 0.7.

netlist_generated


Day 02

Timing library hierarchical vs flat synthesis and efficient flop coding styles


Introduction to timing library

skywater-pdk-logo

sky130_fd_sc_hd_tt_025C_1v80.lib

the liberty timing file(.lib) is an ASCII file consists of detailed information of timing and power parameters about any standard cell of a particular technology node. The parameters are affected by PVT variations (process, voltage, temperature). These variations are factorized while designing IC. So the Standard Cell library is characterized to model these variations. The feature size in this technology node is 130nm. The terms in the .lib file are:-

  • fd - the skywater foundary
  • sc - digital standard cell
  • hd - high density
  • tt - typical process
  • 025C - temperature
  • 1v - voltage

library in the sky130 pdk are named using the following scheme:

"" Process name _ Library Source Abbreviation _ Library Type Abbreviation _ Library Name ""

Library Source Abbreviation
The SkyWater Foundary fd
Efabless ef
Oklahoma State University osu
Library Type Abbreviation
Primitive Cells pr
Digital Standard Cells sc
Build Space(Flash, SRAM, etc) sp
IO and Periphery io
High Densiry hd

Skywater Foundary provided standard cell libraries

  • sky130_fd_sc_hd - High Density Standard Cell Library.
  • sky130_fd_sc_hdll - High Density, Low Leakage Standard Cell Library.
  • sky130_fd_sc_hs - Low Voltage (<2.0V), High Speed, Standard Cell Library.
  • sky130_fd_sc_ms - Low Voltage (<2.0V), Medium Speed, Standard Cell Library.
  • sky130_fd_sc_ls - Low Voltage (<2.0V), Low Speed, Standard Cell Library.
  • sky130_fd_sc_lp - Low Voltage (<2.0V), Low Power, Standard Cell Library.
  • sky130_fd_sc_hvl - High Voltage (5V), Standard Cell Library.

more details can be found at skywater-pdf.

standard cell definition of and3_or1_invert:-

standard_cell_definition

area comparison of different types of and cells.

area_comparison

Hierarchical vs Flat Synthesis


hierarchical synthesis

the synthesis results obtained after hierarchical synthesis shows that the sub-modules and the hierarchy of it's instantiation is preserved. The design is partitioned into a much higher level of abstraction. synth_multiple_module

logical description of hierarchical synthesis

show_hierar

netlist of hierarchical synthesis

netlist_noattr

Note: in the Hierarchical Synthesis the design is partitioned into sub-modules hence it becomes easy to trace back each component of the design. Also the design complexity is less and easy to comprehend.

flat synthesis

$ yosys> flatten                                            // to invoke flat synthesis after netlist generation
$ yosys> write_verilog -noattr multiple_modules_flat.v      // to write verilog netlist without attributes(clean)

in the flat synthesis, instantiation of standard cells take place and the design is partitioned into a much lower level of abstraction.

logical description of flat synthesis

show_flattened

netlist comparison of flat synthesis vs hierarchical synthesis

netlist_hie_flat

Sub-module level synthesis

$ yosys> synth -top sub_module1           // to synthesize only the submodule
  • sub-module synthesis is preferred if:
    • there are multiple instances of same module. So it's better to synthesize the module once and then use it multiple times.
    • if desing and conquer approach is required i.e. if the design is very massive and complex, so it's better to synthesize module by module and then finally stitch together all the modules into the top module.

Various Flip Flop coding styles and optimization


asynchronous reset dff

always@(posedge clk or posedge async_reset) begin 
    if(async_reset)  q<= 1'b0;
    else              q<= d_in;
end

async_rst_01 asyn_rst_show

asynchronous set dff

always@(posedge clk or posedge async_set) begin
    if(async_set)  q<= 1'b1;
    else           q<= d_in;
end

async_set async_set_show_synth

asynchronous-synchronous reset dff

always@(posedge clk or posedge async_reset) begin
    if(async_reset)     q<= 1'b0;
    else if(sync_reset) q<= 1'b0;
    else                q<= d_in;
end

dff_asyncres_syncres_vcd asyncres_synres_show_abc

synchronous reset dff

always@(posedge clk) beign
    if(sync_reset)  q<= 1'b0;
    else            q<= d_in;
 end

syncres_waveform dff_synres_show

Note

  • Asynchronous reset pin is directly synthesized on the flip flop.
  • Synchronous reset signal is passed through a combinational logic to the flip flop.

Optimization in constant multiplier circuit

module mul2(
  output wire y[3:0],
  input wire in[2:0]
);
    assign y= a * 2;
endmodule
// there is an interesting optimiztion taking place here instead of generating any hardware for the logic.

Note

  • there are only wire components in the circuit. Also note the comment by the synthesis tool(yosys) while mapping.

mult2_abc

  • netlist mult2_netlist
  • logical description mult2_show
Similar optimization
module mul8(
    output wire y[5:0],
    input wire in[2:0]
    );
        assign y= a * 9;
endmodule

Note

  • here replication of input takes place.

mult8_abc_response

  • netlist mult8_netlist
  • logical description mult8_show

Day 03

Combinational and Sequential Optimization


Introduction to optimizations

command to perform optimization

$ yosys > opt_clean -purge        // all optimizations are done with this

Combinational logic optimization

  • case 1
module opt_check(                             

  output wire y,
  input wire a,
  input wire b
);
    assign y= a ? b : 0;
endmodule
  • expected optimization by tool.

opt1_theory

  • result obtained.

opt1_show

  • Case 2
module opt_check(
  output wire y,
  input wire a,
  input wire b
);
    assign y= a ? 1 : b;
endmodule
  • expected optimization by tool.

opt2_theory

  • result obtained.

opt2_show

About


Languages

Language:Verilog 100.0%