Giter VIP home page Giter VIP logo

Comments (4)

msfschaffner avatar msfschaffner commented on June 24, 2024 1

Let me know if you need more info or whether I should test something.

I still need to think about how we can check for success at the end of the flow...

from edalize.

msfschaffner avatar msfschaffner commented on June 24, 2024

@olofk, if you need someone to help with this (including running some tests) I can assist.

from edalize.

olofk avatar olofk commented on June 24, 2024

That would be excellent. DC is one of the most requested tools. I very much appreciate the offer to help since I don't have access to the tool myself

from edalize.

msfschaffner avatar msfschaffner commented on June 24, 2024

Ok so DC is a bit tricky, since in addition to the tool flow itself, you need to set up technology specific libraries to make this work. Hence, it is in general not possible to provide a "default" flow that will just run out of the box. The user always has to supply a minimum amount of info about his technology setup.

The flow could be built on top of what is provided for AscentLint at the moment.

It would be great to support three modes here:

  1. batch
  2. interactive shell
  3. gui

For 1. and 2., the tool can be invoked as follows (just the exit statement should not be inserted into the runfile for 2.)

TERM="dtterm" dc_shell-xg-t $@ -f synth.tcl | tee synth.log

For 3., and additional -gui switch is required

TERM="dtterm" dc_shell-xg-t $@ -f synth.tcl -gui | tee synth.log

The terminal setting is a bit peculiar, but required such that the DC shell works correctly.

The main run file is synth.tcl and is meant to contain a simple synthesis flow.

#####################
##  PREPARE FLOW   ##
#####################

# this is a setup script that the user needs to provide (see template below). 
source setup.tcl

# paths
set WORKLIB  "WORK"
set REPDIR   "REPORTS"
set DDCDIR   "DDC"
set VLOGDIR  "NETLISTS"

exec mkdir -p ${REPDIR} ${DDCDIR} ${VLOGDIR} ${WORKLIB}

# define work lib path
define_design_lib WORK -path $WORKLIB

#######################
##  DESIGN SOURCES  ###
#######################

# define the top level 
set TOP_ENTITY <TOP_ENTITY_NAME>

# read source list generated by fusesoc
set fp [open [ls "*.scr"] r]
set file_data [read $fp]
close $fp
set data [split $file_data "\n"]

# if needed, this define can be used to selects the appropriate technology 
# by defining PRIM_DEFAULT_IMPL=prim_pkg::Impl<tech identifier>
# TECH_LIB_SEL is set inside the library setup script
set DEFINE "PRIM_DEFAULT_IMPL=<PRIM_DEFAULT_IMPL> "

# parse out the SV +defines that Fusesoc puts into the source list
set SRC {}
foreach item $data {
	if {[string range $item 0 7] == "+define+"}  {
		set DEFINE "${DEFINE}[string range $item 8 end] "
	} else {
		lappend SRC $item
	}
}

# additional parameter override (empty at the moment, 
# could be passed through by fusesoc as well in a similar way as +define)
set PARAMS ""

###########################
##   ELABORATE DESIGN    ##
###########################

# delete previous designs.
remove_design -designs
sh rm -rf $WORKLIB/*

analyze -define ${DEFINE} -format sv ${SRC}    > "${REPDIR}/${TOP_ENTITY}_analyze.rpt"
elaborate  ${TOP_ENTITY} -parameters ${PARAMS} > "${REPDIR}/${TOP_ENTITY}_elab.rpt"
link                                           > "${REPDIR}/${TOP_ENTITY}_link.rpt"

write_file -format ddc -hierarchy -output "${DDCDIR}/${TOP_ENTITY}_elab.ddc"
write_file -format verilog -hierarchy -output "${DDCDIR}/${TOP_ENTITY}_elab.v"

###########################
##   APPLY CONSTRAINTS   ##
###########################

# user needs to supply a constraints file, see below for a template
source constraints.tcl

######################
##    MAP DESIGN    ##
######################

# gate_clock, scan and no_autoungroup are all options that are typically used
# maybe we can add a tool parameter like "compile_ultra_switches", which contains a list of these
compile_ultra -gate_clock -scan -no_autoungroup > "${REPDIR}/${TOP_ENTITY}_compile.rpt"

#################
##   REPORTS   ##
#################

# write NAND2 equivalent to file for the reporting scripts
sh echo ${NAND2_GATE_EQUIVALENT} > "${REPDIR}/${TOP_ENTITY}_gate_equiv.rpt"

report_clocks                                 > "${REPDIR}/${TOP_ENTITY}_clocks.rpt"
report_timing -nosplit -slack_lesser_than 0.0 > "${REPDIR}/${TOP_ENTITY}_timing.rpt"
report_area   -hier -nosplit                  > "${REPDIR}/${TOP_ENTITY}_area.rpt"
report_power  -hier -nosplit                  > "${REPDIR}/${TOP_ENTITY}_power.rpt"
report_constraints -all_violators             > "${REPDIR}/${TOP_ENTITY}_constraints.rpt"

report_timing      -nosplit -nworst 1000 -input -net -trans -cap > "${REPDIR}/${TOP_ENTITY}_timing_long.rpt"

#################
##   NETLIST   ##
#################

change_names -rules verilog -hierarchy
write_file -format ddc     -hierarchy -output "${DDCDIR}/${TOP_ENTITY}_mapped.ddc"
write_file -format verilog -hierarchy -output "${VLOGDIR}/${TOP_ENTITY}_mapped.v"

# do not include in interactive modes
exit

the user must provide the two TCL files setup.tcl and constraints.tcl for this to work.

the setup file should look as follows:

########################
##    TOOL SETUP      ##
########################

# this depends #available licenses and compute environment
set_host_options -max_cores 1

########################
##   LIBRARY SETUP    ##
########################

# path to synopsys installation
set SYNOPSYS_PATH   "<SYNOPSYS_PATH>"  
# paths to standard cell and sram db files
# this is just an example
set STDCELL_DB_PATH "<STDCELL_DB_PATH>" 
set SRAM_DB_PATH    "<SRAM_DB_PATH>" 

# library name prefix
set VARIANT  "<MY_LIBRARY>"

# corners to use
# it is advisible to use worst case 
# (i.e. wc or ss corners at high temp like 125c)
set STDCELL_CORNER "<TECH_CORNER>"
# select memory corners
set SRAM_CORNER    "<TECH_CORNER>"

# this could eventually be moved into .synopsys_dc.setup
set search_path [list .                                  \
                      "${SYNOPSYS_PATH}/libraries/syn"   \
                      "${SYNOPSYS_PATH}/dw/sim_ver"      \
                      ${STDCELL_DB_PATH} ${SRAM_DB_PATH} ]

set target_library [list "${VARIANT}_${STDCELL_CORNER}.db" \
                         "<MACRO_NAME>_${SRAM_CORNER}.db"  ]

set synthetic_library [list dw_foundation.sldb]
set synlib_wait_for_design_license [list "DesignWare-Foundation"]
set link_library [concat [concat "*" $target_library] $synthetic_library]
set symbol_library [list generic.sdb]

# used to constrain IOs in constraints
set load_lib "${VARIANT}_${STDCELL_CORNER}"
set driving_cell <NAME_OF_DRIVING_CELL>
set load_cell    <NAME_OF_LOAD_CELL>

# a NAND2 gate equivalent in this tech (for reporting purposes)
# this the area [um^2] of a Nand2 x1 gate
set NAND2_GATE_EQUIVALENT <number>

note that the tool setup could also be moved into a file named .synopsys_dc.setup which DC will automatically source upon startup. the above method is however more explicit and probably better suited to the fusesoc flow (.-prefixed files are not always well visible when browsing the directory).

the constraints file should look as follows:

# set primary clock and reset name
set CLK_PIN clk_i
set RST_PIN rst_ni

# timing constraint in ns 
set TCK     10.0
set IN_DEL  2.0
set OUT_DEL 2.0
set DELAY   ${TCK}

# define a primary clock
create_clock ${CLK_PIN} -period ${TCK}

# assume these nets are ideal during synthesis
set_ideal_network ${CLK_PIN}
set_ideal_network ${RST_PIN}

# constrain all combinatorial paths
set_max_delay ${DELAY} -from [all_inputs] -to [all_outputs]
set_input_delay ${IN_DEL} [remove_from_collection [all_inputs] {${CLK_PIN}}] -clock ${CLK_PIN}
set_output_delay ${OUT_DEL}  [all_outputs] -clock ${CLK_PIN}

# input/output pins of stdcells are typically labelled with A,X,Y,Z or similar
set_driving_cell  -no_design_rule -lib_cell ${driving_cell} -pin X [all_inputs]
set_load [load_of ${load_lib}/${load_cell}/A] [all_outputs]

from edalize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.