Top Banner
SystemVerilog Configurations and Tool Flow Using SCons (an Improved Make) 1 Don Mills Dillan Mills Microchip Technology Inc. Microchip Technology Inc.
39

SystemVerilog Configurations and Tool Flow Using SCons (an ...

Feb 12, 2022

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: SystemVerilog Configurations and Tool Flow Using SCons (an ...

SystemVerilog Configurations and Tool Flow Using SCons (an Improved Make)

1

Don Mills Dillan MillsMicrochip Technology Inc. Microchip Technology Inc.

Page 2: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Motivation for paper

2

• SystemVerilog Configurations• No one knows how to set up configs for the tools

• (except the experts)

• SCons• Like Make but…• better - faster - stronger

• We can build it, “we have the technology”

• Why combine both in one paper?

Page 3: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Test Circuit for Paper

3

Page 4: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Configuration Libraries

4

• Two parts to Configurations • Library files

• Declares which files are in which library• Config files (next slide)libmap.sv file

library rtlLib rtl_adder.sv,dual_adder.sv;

library gateLib gate_adder.sv,gate_adder_alt.sv;

library testLib top.sv,adder_test.sv;

Page 5: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Configuration Files

5

• Two parts to Configurations (Continued)• Config files

• Declares the design top and which library is resides in

config.sv file

config rtl_config;design testLib.top;default liblist rtlLib;

endconfig

config cell_config;design testLib.top;default liblist rtlLib;cell adder use gateLib.adder;

endconfig

config inst_config;design testLib.top;default liblist rtlLib;instance top.dut.adder2

use gateLib.adder_alt;endconfig

Page 6: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Configuration Files

5

• Two parts to Configurations (Continued)• Config files

• Declares the design top and which library is resides in

• Declares a default library for searching cells not otherwise specified

config.sv file

config rtl_config;design testLib.top;default liblist rtlLib;

endconfig

config cell_config;design testLib.top;default liblist rtlLib;cell adder use gateLib.adder;

endconfig

config inst_config;design testLib.top;default liblist rtlLib;instance top.dut.adder2

use gateLib.adder_alt;endconfig

Page 7: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Configuration Files

5

• Two parts to Configurations (Continued)• Config files

• Declares the design top and which library is resides in

• Declares a default library for searching cells not otherwise specified

• Declares replacement item(s) – By cell or by instance

config.sv file

config rtl_config;design testLib.top;default liblist rtlLib;

endconfig

config cell_config;design testLib.top;default liblist rtlLib;cell adder use gateLib.adder;

endconfig

config inst_config;design testLib.top;default liblist rtlLib;instance top.dut.adder2

use gateLib.adder_alt;endconfig

Page 8: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Configuration Files

5

• Two parts to Configurations (Continued)• Config files

• Declares the design top and which library is resides in

• Declares a default library for searching cells not otherwise specified

• Declares replacement item(s) – By cell or by instance– Which library to find the replacement item(s)

config.sv file

config rtl_config;design testLib.top;default liblist rtlLib;

endconfig

config cell_config;design testLib.top;default liblist rtlLib;cell adder use gateLib.adder;

endconfig

config inst_config;design testLib.top;default liblist rtlLib;instance top.dut.adder2

use gateLib.adder_alt;endconfig

Page 9: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Configuration File Gotcha

13

• The default liblist can contain a list of libraries

• This is list of libraries is one of the few (maybe the only) place in SystemVerilog where a list of items are not comma separated

config rtl_config;design testLib.top;default liblist rtlLib testLib;

endconfig

Page 10: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Vendor Command Switches(alphabetically)

Cadence

14

prompt> xrun -libmap libmap.sv \-compcnfg configs.sv \-f source.f \-top cell_config

source.f fileadder_test.svdual_adder.svgate_adder.svgate_adder_alt.svrtl_adder.svtop.svconfigs.sv

• Specify in the xrun command – the libmap file

Page 11: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Vendor Command Switches(alphabetically)

Cadence

14

prompt> xrun -libmap libmap.sv \-compcnfg configs.sv \-f source.f \-top cell_config

source.f fileadder_test.svdual_adder.svgate_adder.svgate_adder_alt.svrtl_adder.svtop.svconfigs.sv

• Specify in the xrun command – the libmap file– the configuration file

Page 12: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Vendor Command Switches(alphabetically)

Cadence

14

prompt> xrun -libmap libmap.sv \-compcnfg configs.sv \-f source.f \-top cell_config

source.f fileadder_test.svdual_adder.svgate_adder.svgate_adder_alt.svrtl_adder.svtop.svconfigs.sv

• Specify in the xrun command – the libmap file– the configuration file– which configuration you want to

use from the config file

Page 13: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Vendor Command Switches(alphabetically)

Cadence

14

prompt> xrun -libmap libmap.sv \-compcnfg configs.sv \-f source.f \-top cell_config

source.f fileadder_test.svdual_adder.svgate_adder.svgate_adder_alt.svrtl_adder.svtop.svconfigs.sv

• Specify in the xrun command – the libmap file– the configuration file– which configuration you want to

use from the config file– and of course, the source file

Page 14: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Vendor Command Switches(alphabetically)

Cadence

14

prompt> xrun -libmap libmap.sv \-compcnfg configs.sv \-f source.f \-top cell_config

source.f fileadder_test.svdual_adder.svgate_adder.svgate_adder_alt.svrtl_adder.svtop.svconfigs.sv

Must be last in list for one of the vendors

• Specify in the xrun command – the libmap file– the configuration file– which configuration you want to

use from the config file– and of course, the source file

Page 15: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Vendor Command Switches(alphabetically)

Mentor

15

prompt> vlog -libmap libmap.sv \-f source.f

prompt> vsim cell_config \-c \-do run.do

run.do filerun -allexit

source.f fileadder_test.svdual_adder.svgate_adder.svgate_adder_alt.svrtl_adder.svtop.svconfigs.sv

• Compile (vlog) the libmap and source files

Page 16: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Vendor Command Switches(alphabetically)

Mentor

15

prompt> vlog -libmap libmap.sv \-f source.f

prompt> vsim cell_config \-c \-do run.do

run.do filerun -allexit

source.f fileadder_test.svdual_adder.svgate_adder.svgate_adder_alt.svrtl_adder.svtop.svconfigs.sv

• Compile (vlog) the libmap and source files

• Specify in the vsim command which configuration you want to use from the config file

Page 17: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Vendor Command Switches(alphabetically)

Mentor

15

prompt> vlog -libmap libmap.sv \-f source.f

prompt> vsim cell_config \-c \-do run.do

run.do filerun -allexit

source.f fileadder_test.svdual_adder.svgate_adder.svgate_adder_alt.svrtl_adder.svtop.svconfigs.sv

Must be last in list for one of the vendors

• Compile (vlog) the libmap and source files

• Specify in the vsim command which configuration you want to use from the config file

Page 18: SystemVerilog Configurations and Tool Flow Using SCons (an ...

prompt> vlogan -full64 \-diag libconfig \-sverilog \-libmap libconfig \-f source.f

prompt> vcs -full64 \-diag libconfig \-debug_access \-R cell_config \-ucli \-i run_vcs.do

Vendor Command Switches(alphabetically)

Synopsys

16

run_vcs.do filerunexit

synopsys_sim.setup fileWORK > DEFAULTDEFAULT : workrtllib : rtlLibgatelib : gateLibtestlib : testLib

source.f fileadder_test.svdual_adder.svgate_adder.svgate_adder_alt.svrtl_adder.svtop.svconfigs.sv

• Compile (vlogan) the libmap and source files

Page 19: SystemVerilog Configurations and Tool Flow Using SCons (an ...

prompt> vlogan -full64 \-diag libconfig \-sverilog \-libmap libconfig \-f source.f

prompt> vcs -full64 \-diag libconfig \-debug_access \-R cell_config \-ucli \-i run_vcs.do

Vendor Command Switches(alphabetically)

Synopsys

16

run_vcs.do filerunexit

synopsys_sim.setup fileWORK > DEFAULTDEFAULT : workrtllib : rtlLibgatelib : gateLibtestlib : testLib

source.f fileadder_test.svdual_adder.svgate_adder.svgate_adder_alt.svrtl_adder.svtop.svconfigs.sv

• Compile (vlogan) the libmap and source files

• Specify in the vcs command which configuration you want to use from the config file

Page 20: SystemVerilog Configurations and Tool Flow Using SCons (an ...

prompt> vlogan -full64 \-diag libconfig \-sverilog \-libmap libconfig \-f source.f

prompt> vcs -full64 \-diag libconfig \-debug_access \-R cell_config \-ucli \-i run_vcs.do

Vendor Command Switches(alphabetically)

Synopsys

16

run_vcs.do filerunexit

synopsys_sim.setup fileWORK > DEFAULTDEFAULT : workrtllib : rtlLibgatelib : gateLibtestlib : testLib

source.f fileadder_test.svdual_adder.svgate_adder.svgate_adder_alt.svrtl_adder.svtop.svconfigs.sv

• Compile (vlogan) the libmap and source files

• Specify in the vcs command which configuration you want to use from the config file

• The setup file must be visible

Page 21: SystemVerilog Configurations and Tool Flow Using SCons (an ...

prompt> vlogan -full64 \-diag libconfig \-sverilog \-libmap libconfig \-f source.f

prompt> vcs -full64 \-diag libconfig \-debug_access \-R cell_config \-ucli \-i run_vcs.do

Vendor Command Switches(alphabetically)

Synopsys

16

run_vcs.do filerunexit

synopsys_sim.setup fileWORK > DEFAULTDEFAULT : workrtllib : rtlLibgatelib : gateLibtestlib : testLib

source.f fileadder_test.svdual_adder.svgate_adder.svgate_adder_alt.svrtl_adder.svtop.svconfigs.sv

Must be last in list for one of the vendors

• Compile (vlogan) the libmap and source files

• Specify in the vcs command which configuration you want to use from the config file

• The setup file must be visible

Page 22: SystemVerilog Configurations and Tool Flow Using SCons (an ...

SCons: A Software Construction Tool

17

Configuration files are all Python scripts

Use the power of a complete programming language to solve complex build configuration issues

Page 23: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Automatic Dependency Tree Generation

31

• Supports a regex-based “scanner” that searches files for dependencies

• Make SCons aware of the root file and it will monitor all files for changes

• Only re-compiles when a change is detected

env.Compile(compile.log, files_a.f)

No EDA tools necessary to create a Makefile

files_a.f

files_b.f pkg.sv

Compile

file_d.svfile_c.svfile_b.svfile_a.sv

Page 24: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Automatic Dependency Tracking

32

dut.sv tb.f

tb_a.sv tb_b.sv

Compile DUT Compile TB

Elaborate

Simulate

Page 25: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Automatic Dependency Tracking

32

• First pass: “scons simulate” at the command line

dut.sv tb.f

tb_a.sv tb_b.sv

Compile DUT Compile TB

Elaborate

Simulate

Page 26: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Automatic Dependency Tracking

32

• First pass: “scons simulate” at the command line•Compile the DUT tb.f

tb_a.sv tb_b.sv

Compile TB

Elaborate

Simulate

dut.sv

Compile DUT

Page 27: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Automatic Dependency Tracking

32

• First pass: “scons simulate” at the command line•Compile the DUT•Compile the TB

dut.sv

Compile DUT

Elaborate

Simulate

tb.f

tb_a.sv tb_b.sv

Compile TB

Page 28: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Automatic Dependency Tracking

32

• First pass: “scons simulate” at the command line•Compile the DUT•Compile the TB•Elaborate

dut.sv tb.f

tb_a.sv tb_b.sv

Compile DUT Compile TB

Simulate

Elaborate

Page 29: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Automatic Dependency Tracking

32

• First pass: “scons simulate” at the command line•Compile the DUT•Compile the TB•Elaborate•Start a Simulation

dut.sv tb.f

tb_a.sv tb_b.sv

Compile DUT Compile TB

Elaborate

Simulate

Page 30: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Automatic Dependency Tracking

32

• First pass: “scons simulate” at the command line•Compile the DUT•Compile the TB•Elaborate•Start a Simulation

• Next pass: “scons simulate”

dut.sv tb.f

tb_a.sv tb_b.sv

Compile DUT Compile TB

Elaborate

Simulate

Page 31: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Automatic Dependency Tracking

32

• First pass: “scons simulate” at the command line•Compile the DUT•Compile the TB•Elaborate•Start a Simulation

• Next pass: “scons simulate”•Only dut.sv was changed, so no need to compile TB

tb.f

tb_a.sv tb_b.sv

Compile TB

Elaborate

Simulate

dut.sv

Compile DUT

Page 32: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Automatic Dependency Tracking

32

• First pass: “scons simulate” at the command line•Compile the DUT•Compile the TB•Elaborate•Start a Simulation

• Next pass: “scons simulate”•Only dut.sv was changed, so no need to compile TB

dut.sv tb.f

tb_a.sv tb_b.sv

Compile DUT Compile TB

Simulate

Elaborate

Page 33: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Automatic Dependency Tracking

32

• First pass: “scons simulate” at the command line•Compile the DUT•Compile the TB•Elaborate•Start a Simulation

• Next pass: “scons simulate”•Only dut.sv was changed, so no need to compile TB

dut.sv tb.f

tb_a.sv tb_b.sv

Compile DUT Compile TB

Elaborate

Simulate

Page 34: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Automatic Dependency Tracking

32

• First pass: “scons simulate” at the command line•Compile the DUT•Compile the TB•Elaborate•Start a Simulation

• Next pass: “scons simulate”•Only dut.sv was changed, so no need to compile TB

dut.sv tb.f

tb_a.sv tb_b.sv

Compile DUT Compile TB

Elaborate

Simulate

Page 35: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Automatic Dependency Tracking

33

• Compile each block, TB, C code in parallel

• Only recompile changed sub-blocks on future passes

• Sub-block compiling can be delegated to the sub-block project

Compile Block 1

Compile Block 2

Compile Block N

… Compile C code

Compile TB

Simulate

Page 36: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Centralized Commands

34

Source Control Sub-Module

Compile DUT

Compile TB

Elaborate Simulate

Project-specific

SConstructfile

• Keep base commands and default arguments in source control and share it with each project

• Configure project-specific options in the local SConstruct file

• Keeps default commands simple, just a function call

Page 37: SystemVerilog Configurations and Tool Flow Using SCons (an ...

What Does It Look Like?

51See the paper for an in-depth tutorial and example on using SCons

env = Environment(…)

com = env.Com(‘com.log', 'files.f')elab = env.Elab('elab.log', com)sim = env.Sim('sim.log', elab)Alias('sim’, [sim])

User-facing code…def Com(env, target, source, …)

return ‘$COM_CMD -f $SOURCE –l $TARGET’

def Elab(env, target, source, …)return ‘$ELAB_CMD -lib $WORK –l $TARGET’

def Sim(env, target, source, …)return ‘$SIM_CMD -lib $WORK –l $TARGET’

Centralized code

> scons sim

Command-line

Page 38: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Some Additional Features

52

• Uses a self-contained environment, allowing for consist, portable, and clear build environments

• Cross-platform• Use Python to programmatically set

up• simulation targets • regressions • command line arguments • randomize seeds • And more!

• Detect file changes using MD5 instead of timestamp

• Create pseudo-builder python functions to do maintenance tasks such as • setting up work libraries • generating or publishing coverage • generating TCL simulation files• And more!

• Extensible, add support for any other needed languages or commands

Page 39: SystemVerilog Configurations and Tool Flow Using SCons (an ...

Conclusion

53

• SystemVerilog Configurations• Now everyone knows how to set up configs for

the tools • (except those who don’t read the paper)

• SCons• Like Make but…• better - faster - stronger

• We can build it better and faster, “we have the [better] technology”