Aging(YuLing)

tags: aging

交接文件
Analyze

Experiment

  • hspice_experiment
    算出每個 benchmark 的 delay 和 power consumption
  • gen_benchmark_profile
    將 hspice result 整理成 benchmark profile (每個 task 每年的 delay, power infromation)

Hsipice Experiment

算出每個 benchmark 的 delay 和 power consumption

file structure

./hsipice_experiment/
├── benchmark/    
├── c432/
├── customized_32nm_model_card/
├── hspice_result/
├── input_pattern/
├── log/
├── model_card/
├── ncverilog/
├── script/
├── test_header/
└── v2lvs/
  • benchmark目錄中是放isca85跟itc99的電路檔案,包含.v檔和.sp檔
  • input_pattern目錄是放要餵進各個電路的input pattern,每組input pattern set相當於一個task
  • ncverilog目錄是利用ncverilog來產生電路在各個input pattern set所對應的output pattern set。目的是最後用來驗證hspice的模擬結果(.sp)是否跟ncverilog的結果(.v)一致
  • customized_32nm_model_card 目錄中是放NMOS的model card檔 (hspice會用到)
  • model_card 目錄是存放不同老化時間點PMOS的model card檔 (hspice會用到)
  • hspice_result 目錄是存放各個電路經過hspice模擬後的結果,包含delay跟power等資訊
  • test_header 目錄是存放所有不同參數(i.e.不同老化時間, 不同電壓)的spice檔
  • 其他的檔案就屬於執行實驗會用到的腳本(.pl)以及過程中產生的log檔

hsipice_experiment/

先把所有 script 都 link 到這個目錄下,這樣執行時路徑才不會出錯

ln -s script/* .

在這個實驗中會執行 4 個 script:

  1. gen_input_pattern.pl
    產生 benchmark circuit 的 input pattern
  2. run_ncverilog.pl
    使用ncverilog根據input pattern set來模擬出電路對應的output pattern set,此步驟的目的是最後用來驗證hspice的模擬結果是否跟ncverilog的結果一致
  3. run_input_profile.pl
    產生 benchmark circuit 在某個電壓之下,不同條件的 (i.e. 不同老化時間, 不同電壓)spice 檔案
  4. run_hspice.pl
    將第3的步驟所產生的spice用hspice模擬,得出電路在不同老化時間,不同電壓下的delay以及power資訊

1. gen_input_pattern.pl

隨機產生電路的input pattern set

demo

./gen_input_pattern.pl $benchmark $number_of_tasks $number_of_pattern

run

./gen_input_pattern.pl c432 20 16

./gen_input_pattern.pl

# 1) parser # @input_port = parse_verilog_file($benchmark_itc_verilog_dir, $benchmark_name,3); # 3:return input_port @input_port = parse_verilog_file($benchmark_isca_verilog_dir, $benchmark_name,3); # 3:return input_port

第一次run的時候遇到錯誤

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

沒抓到header.pm

sol

./ncverilog/加入環境變數中
export PERLLIB

export PERLLIB=/home/wang/aging/hspice_experiment/ncverilog

export後,可執行,但出現第二個ERROR

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

sol

./ncverilog/gen_hspice_header.pm中找到進行修改

sub transpose_input_vec_file{ ... my $input_dir = "./input_pattern"; ... }

執行後可以看到 input_pattern/c432 目錄下產生了 20 組 input_vec_file,

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

trans 開頭的是將原本的 input_vec_file 進行transpose 得到的,這只是為了方便 script 讀取,不須理會

打開其中一個

vi ./input_pattern/c432/rand_input_vector_c432_0.out

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

檔名最後面的 0 代表這是 task 0,可以看到裡面有 16 組 input pattern,每一條 pattern 的長度等於 input pin 個數

big core

這邊產生出來的little core (ex. C432)的input pattern 要轉化成big core(ex. c432d)的input pattern,因為big core 的pattern長度會是little core的兩倍,而組數將會減半
./auto_copy_input_pattern.pl中修改

system("./copy_input_pattern.pl c432 c432d 20 32");

modify ./script/copy_input_pattern.pl
c432d.visca85_v底下

my $fr_benchmark_name = $ARGV[0]; my $to_benchmark_name = $ARGV[1]; my $benchmark_verilog_dir = "./benchmark/isca85_v"; #my $benchmark_verilog_dir = "./benchmark/itc99_v";
run
./auto_copy_input_pattern.pl

輸出檔案會放在 ./input pattern/c432d

vi ./input_pattern/c432d/rand_input_vector_c432d_0.out

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

2. run_ncverilog.pl

要先source ncverilog

big core 和 LITTLE core 都要執行 ncverilog
以下以LITTLE core為例

demo

./run_ncverilog.pl $benchmark $number_of_tasks

run

./run_ncverilog.pl c432 20
./run_ncverilog.pl c432d 20

c432 : 要模擬的電路
20 : ./gen_input_pattern.pl所產生的input pattern set 總數

./run_ncverilog.pl

elsif($benchmark eq "c432"){ $str = "N223 N329 N370 N421 N430 N431 N432"; $path = "isca85_v"; }

./ncverilog/isca85_v/ 執行 c432.v 和對應的textfixture.v,所以要先 source ncverilog

system("ncverilog $path/$benchmark\_testfixture.v $path/$benchmark.v +nc64bit +access+r");

sed

system("sed -i '1d' $benchmark/rand_input_vector_$benchmark\_$i.out"); // 刪除第一行

執行完後,會在./hspice_experiment/input_pattern/c432中多了output pattern相關的檔案


而這些檔案是最後拿來驗證hspice的模擬結果是否跟ncverilog模擬的結果一致

3. run_input_profile.pl

0.8v or 1.2v 要抓取的電壓
LITTLE core是用 0.8v
big core是用1.2v

demo

./run_input_profile.pl $benchmark $number_of_pattern $number_of_tasks

LITTLE(0.8v)

run
./run_input_profile.pl c432 16 20

big(1.2v)

run
./run_input_profile.pl c432d 8 20

4. run_hspice.pl

Update:
2021.12.21: 按照aging順序執行hspice

LITTLE
./run_hspice.pl c432 N |& tee log/run_hspice_c432.log
big
./run_hspice.pl c432d N |& tee log/run_hspice_c432d.log

Generate Benchmark Profile

將 hspice result 整理成 benchmark profile (每個 task 每年的 delay, power infromation)

file structure

./gen_benchmark_profile/
├── Makefile
├── benchmark_profile
├── env
├── final_result
├── main
├── object_code
├── result
├── run_simulate.pl
├── simulate_parameter.pl
├── source_code
└── task_graph

將前面 hspice experiment 所產生的結果,蒐集成一個紀錄 delay/power consumption 的檔案 (benchmark_profile),後續的 multicore experiment 會使用這些 benchmark_profile

step1

run_simulate.pl
修改 benchmark 名稱

step2

source_code/getTaskProfile.cpp
將最底下的 GetTaskProfile function 內的第一個for迴圈中的數字,改成要讀取的電壓值
(例如 hspice experiment中,little core 用 0.8v,則設 i=8;i<9)

run

// ./gen_benchmark_profile/ 下
touch *
make


XXX is up to date
檢查是否有重複的檔案

step3

run

./run_simulate.pl

遇到 Fail to open 的錯誤訊息
通常是因為有些 result 檔案沒有放到正確位置,因此讀取不到,例如以下,把 0_12_50_9m.* 全放進 0_12_50_9m/ ,再重跑一次即可

Multicore Experiment

.multicore_experiment/
├── benchmark_profile/
├── gen_env/
├── parse_result/
├── object_code/
├── source_code/
    ├── getTaskProfile.h
    ├── getTaskProfile.cpp
    ├── parseENV.h
    ├── parseENV.cpp
    ├── parseSTG.h
    ├── parseSTG.cpp
    ├── read_mt.h
    ├── read_mt.cpp
    ├── readTaskProfile.h
    ├── readTaskProfile.cpp
    ├── task.h
    ├── task.cpp
    ├── sim.h
    ├── sim.cpp
    └──  main.cpp
 ├── task_graph
 └── env

這個實驗中,會模擬heterogeneous multicore system的行為,讀取事先定義好的 task graph,依序執行 task

step1

./run_simulate.pl 中,設定 big/little core 的 benchmark,以及設定要 run 的 policy

step2

設定 env (critical task 和 non-critical task 組合)

env 表示各種critical task的比例(ex. 0.2,0.4,0.6 ),在每一個round,little和 big core所個要執行的task 的個數

./gen_env 裡面可以自行產生env,進入./gen_env資料夾
執行 ./ gen_env.pl 會產生test_env檔案,再自行複製至上層,並且重新命名為env

step3

執行 ./run_simulate.pl
結果會儲存在result/big_little/c432_c432d

step4

修改 ./parse_result.pl 的benchmark

step5

執行 ./parse_result,結果會整理成一份 csv 檔案,其中包含
- 每個 policy 的 big/little cluster/total lifetime, energe, power consumption
- 每個 policy 的結果 normalize 到 Sym policy 的結果