OpenPiton with RISC-V Cores A Hands-On Tutorial with the ...
Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model...
-
Upload
doankhuong -
Category
Documents
-
view
216 -
download
0
Transcript of Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model...
![Page 1: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/1.jpg)
Getting to Work with OpenPiton
Princeton University
OpenPit
http://openpiton.org
![Page 2: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/2.jpg)
Simulating OpenPiton RTL
2
![Page 3: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/3.jpg)
Anatomy of a Simulation
• Simulation model– Design under test (DUT) RTL
– Top-level test bench
– Simulator compiler arguments• Verilog macros, include directories, monitor params, etc.
• Test stimuli– Assembly tests
– C tests
– Source/sink bit vectors • Based on infrastructure from Christopher Batten’s group at Cornell
3
![Page 4: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/4.jpg)
OpenPiton Simulation Models
4
![Page 5: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/5.jpg)
OpenPiton Simulation Models
4
![Page 6: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/6.jpg)
Simulation Scripts/Tools
• sims
– piton/tools/src/sims/sims,1.262
– Adapted from OpenSPARC T1– Build and launch individual simulations– Regressions
• Single simulation model
• contint
– piton/tools/src/contint/contint,1.0
– Calls sims– Continuous integration bundles
• Multiple simulation models
– Currently only supports SLURM job scheduler
• Currently only Synopsys VCS support
5
![Page 7: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/7.jpg)
Building a Simulation Model
• Required sims arguments
-sys=<simulation model>
-vcs_build
• Other useful arguments-vcs_build_args=<VCS arguments>
-debug_all
6
![Page 8: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/8.jpg)
Simulation Model Build Outputs
• stdout and sims.log
• build/<simulation_model>/<vcs_r
el_name>/
– -vcs_rel_name=<name>
• Default is rel-0.1
7
![Page 9: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/9.jpg)
Example: The manycore Model
• sims -sys=manycore -vcs_build
– sims.log: check for build errors
• Check for SIGDIE
– build/manycore/rel-0.1/
8
![Page 10: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/10.jpg)
Running a Simulation
• Required sims arguments-sys=<simulation model>
-vcs_run
<test stimuli>
• Varies by simulation model type (assembly file, source/sink prefix)
• Other useful arguments-vcs_rel_name=<name>
-gui
• Requires –debug_all during build
9
![Page 11: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/11.jpg)
Simulation Outputs
• Depends on test type
• stdout and sims.log
– PASS (HIT GOOD TRAP)
• Test binary (diag.exe)
• Memory image (mem.image)
• Assembler log (midas.log)
• Symbol table (symbol.tbl)
• Performance log (perf.log)
• Status log (status.log)
10
![Page 12: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/12.jpg)
Example: Assembly Test Simulation
• sims -sys=manycore -vcs_run
princeton-test-test.s
– C tests have similar syntax
11
![Page 13: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/13.jpg)
Example output
12
![Page 14: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/14.jpg)
Example output
12
![Page 15: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/15.jpg)
Debugging Simulations
• Monitors (manycore)
– Non-synthesizeable Verilog modules
– Instantiated in top-level test bench
– X-module references DUT signals
• Print useful output
• Check properties
• Tools for parsing simulation output
– pc_grep <log>, reg_grep <log>, etc.
13
![Page 16: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/16.jpg)
Debugging Simulations
14
![Page 17: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/17.jpg)
Debugging Simulations
14
![Page 18: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/18.jpg)
Debugging Simulations
14
![Page 19: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/19.jpg)
Debugging Simulations
14
![Page 20: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/20.jpg)
Debugging Simulations
14
![Page 21: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/21.jpg)
Debugging Simulations
14
![Page 22: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/22.jpg)
Debugging Simulations
• Waveforms - DVE– Build with -debug_all
– Run with –gui
• Example (again):– sims -sys=manycore -vcs_build –
debug_all
– sims -sys=manycore -vcs_run
princeton-test-test.s -gui
15
![Page 23: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/23.jpg)
Debugging Simulations
16
![Page 24: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/24.jpg)
Debugging Simulations
17
![Page 25: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/25.jpg)
Debugging Simulations
17
![Page 26: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/26.jpg)
Exploring the assembly test suite
• piton/verif/diag/assembly/
• Diaglists (piton/verif/diag/*.diaglist)– Groups of assembly tests and assembly test declarations
– Assembly test declarationlabel testfile.s <sims arguments>
– Assembly group definitions
<groupname sys=mymodel sims args>
test1 test1.s
</groupname>
– Groups can be nested
18
![Page 27: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/27.jpg)
Diaglists
19
![Page 28: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/28.jpg)
Diaglists
19
![Page 29: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/29.jpg)
Diaglists
19
![Page 30: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/30.jpg)
Diaglists
19
![Page 31: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/31.jpg)
Common Test Flags
• -rtl_timeout=– Number of cycles sims will wait before timing out the test
• -sim_run_args=– Arguments (e.g. plusargs) to Verilog simulator
• -midas_args=– Arguments to assembler, midas
– Thread count, thread stride, and more
• -finish_mask=– Mask specifying threads to wait for
20
![Page 32: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/32.jpg)
Types of tests
• Thousands of assembly tests
– IFU, TLU, etc
– arch
• fp, exu, mem, trap, etc.
– TSO tests
– PAL-generated (randomized) tests
– C tests
21
![Page 33: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/33.jpg)
Running a Regression
• Groups of tests as defined in diaglists
• Tests utilize the same simulation model
– One build, multiple test runs
• sims -sim_type=vcs –group=<regression
name>
– Simulation model specified by group declaration
– -sim_type=vcs replaces -vcs_build and –vcs_run
22
![Page 34: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/34.jpg)
Running a Regression
• Example:
sims -sim_type=vcs –group=tile1_mini
23
![Page 35: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/35.jpg)
Regression Outputs
• Simulation model will be built as usual in build/<simulation_model>/<vcs_r
el_name>/
• Tests run sequentially
– Test results stored in build/<date>_<id>
• Check results– regreport <test results directory>
24
![Page 36: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/36.jpg)
Regression Outputs
25
![Page 37: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/37.jpg)
Continuous Integration Bundles
• Infrastructure for large scale continuous integration testing
• Supports multiple different simulation models
• Specified by XML files
26
![Page 38: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/38.jpg)
Continuous Integration Bundles<bundles>
<bundle_name>
<asm_test name=“asm_test_name”>
<sys>sim_model</sys>
<asm_diag_name>test.s</asm_diag_name>
</asm_test>
<asm_regress name=“regress_name”>
<sys>sim_model</sys>
<group>regression name</group>
</asm_regress>
<include>sub-bundle name</include>
.
.
.
</bundle_name>
</bundles>
27
![Page 39: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/39.jpg)
Continuous Integration Bundles
28
![Page 40: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/40.jpg)
Running a contint Bundle
• contint – continuous integration tool
– Currently requires SLURM job scheduler
• contint --bundle=<bundle name>
• Example:– contint --bundle=git_push
29
![Page 41: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/41.jpg)
contint Bundle Outputs
• All simulation models will be built and simulations submitted to scheduler
• Results will be aggregated and printed to stdout
• Individual simulation results located in – build/contint_<bundle_name>_<date>_<id>
• Re-process results– contint --bundle=<bundle name> --check_results--contint_dir=<results directory>
• Example:– contint --bundle=git_push --check_results --contint_dir=$PWD/contint_git_push_2016_6_19_0
30
![Page 42: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/42.jpg)
contint Bundle Outputs
31
![Page 43: Simulating OpenPiton RTL - Princeton University · Anatomy of a Simulation •Simulation model –Design under test (DUT) RTL –Top-level test bench –Simulator compiler arguments](https://reader030.fdocuments.us/reader030/viewer/2022040416/5d282ba288c993c82d8cd5f4/html5/thumbnails/43.jpg)
contint Bundle Outputs
32