반도체, 임베디드 Study/디지털 설계

Cadence - Synthesis / Pre_layout Simulation

잇(IT) 2024. 4. 9. 18:10
728x90

Synthesis


Synthesis(합성)는 고수준의 HDL 코드를 하드웨어 리소스로 변환하여 구현 가능한 하드웨어로 만드는 작업이다.

 

합성을 하기 위해서는 게이트에 대한 정보(delay 등)를 담고 있는 [.lib 파일], 코드로 작성한 디지털 회로 설계 파일 [.v 파일], CLK 정보를 담고 있는 [.sdc] 파일이 필요하다.

 

run_counter.tcl

set_db init_lib_search_path ../../LIB/	// 라이브러리 파일 위치
set_db init_hdl_search_path ./rtl/		// hdl 파일 경로

read_libs slow_vdd1v0_basicCells.lib	// lib 파일명
read_hdl counter.v						// hdl 파일명

elaborate
read_sdc ./constraints/constraints_top.sdc	// sdc(clk 정보) 파일 경로 및 sdc 파일명
set_db syn_generic_effort medium
set_db syn_map_effort medium
set_db syn_opt_effort medium

syn_generic
syn_map
syn_opt

#reports									// 합성 결과물에 대한 report 파일들 생성
report_timing > reports/report_timing.rpt
report_power  > reports/report_power.rpt
report_area   > reports/report_area.rpt
report_qor    > reports/report_qor.rpt

#Outputs								// 합성 결과물에 대한 netlist, sdc, sdf 파일 생성
write_hdl > outputs/counter_netlist.v
write_sdc > outputs/counter_sdc.sdc
write_sdf -timescale ns -nonegchecks -recrem split -edges check_edge  -setuphold split > outputs/delays.sdf

 

합성 결과물로 report 파일들이 생성되고, 합성을 통해 디지털 회로를 구성하는 논리 요소들의 연결 정보를 포함하는 .v 파일, 합성을 통해 디지털 회로의 딜레이 정보까지 포함된 파일인 (Standard Delay Format) .sdf 파일이 생성된다.

 

//합성명령어
genus -f run_counter.tcl

 

합성 결과물로 .v, .sdc, .sdf 파일들이 생성된 것을 확인 할 수 있다.

 

counter_netlist.v

module counter(clk, rst, count);
  input clk, rst;
  output [7:0] count;
  wire clk, rst;
  wire [7:0] count;
  wire n_0, n_1, n_2, n_3, n_4, n_5, n_6, n_7;
  wire n_8, n_9, n_10, n_11, n_12, n_13;
  DFFRHQX1 \count_reg[7] (.RN (rst), .CK (clk), .D (n_13), .Q
       (count[7]));
  DFFRHQX1 \count_reg[6] (.RN (rst), .CK (clk), .D (n_12), .Q
       (count[6]));
  XNOR2X1 g184__2398(.A (count[7]), .B (n_11), .Y (n_13));
  OA21X1 g186__5107(.A0 (count[6]), .A1 (n_10), .B0 (n_11), .Y (n_12));
  DFFRHQX1 \count_reg[5] (.RN (rst), .CK (clk), .D (n_9), .Q
       (count[5]));
       ....
       ....

netlist 파일은 verilog로 작성한 HDL 코드(위의 예제에서는 간단히 작성한 counter.v)를 물리적인 하드웨어 수준으로 변경시켜 놓은 코드에 해당한다.

 

counter_sdc.sdc

set sdc_version 2.0

set_units -capacitance 1000fF
set_units -time 1000ps

# Set the current design
current_design counter

create_clock -name "clk" -period 10.0 -waveform {0.0 5.0} [get_ports clk]
set_clock_transition 0.1 [get_clocks clk]
set_clock_gating_check -setup 0.0
set_input_delay -clock [get_clocks clk] -add_delay -max 1.0 [get_ports rst]
set_output_delay -clock [get_clocks clk] -add_delay -max 1.0 [get_ports {count[7]}]
set_output_delay -clock [get_clocks clk] -add_delay -max 1.0 [get_ports {count[6]}]
set_output_delay -clock [get_clocks clk] -add_delay -max 1.0 [get_ports {count[5]}]
....
....

 

delay.sdf

(DELAYFILE
  (SDFVERSION  "OVI 3.0")
  (DESIGN      "counter")
  (DATE        "Wed Apr 10 02:54:52 KST 2024")
  (VENDOR      "Cadence, Inc.")
  (PROGRAM     "Genus(TM) Synthesis Solution")
  (VERSION     "21.16-s062_1")
  (DIVIDER     .)
  (VOLTAGE     ::0.9)
  (PROCESS     "::1.0")
  (TEMPERATURE ::125.0)
  (TIMESCALE   1ns)
  (CELL
     (CELLTYPE "DFFRHQX1")
     (INSTANCE count_reg\[7\])
     (DELAY
        (ABSOLUTE
          (PORT RN (::0.000))
          (PORT CK (::0.000))
          (PORT D (::0.000))
          (IOPATH RN Q () (::0.062))
          (IOPATH CK Q (::0.281) (::0.252))
        )
     )
     (TIMINGCHECK
        (REMOVAL (posedge RN) (posedge CK) (::0.144))
        (RECOVERY (posedge RN) (posedge CK) (::0.000))
        (HOLD (negedge D) (posedge CK) (::0.061))
        (HOLD (posedge D) (posedge CK) (::0.000))
        (SETUP (negedge D) (posedge CK) (::0.010))
        (SETUP (posedge D) (posedge CK) (::0.093))
     )
  )
  (CELL
     (CELLTYPE "DFFRHQX1")
     (INSTANCE count_reg\[6\])
     (DELAY
        (ABSOLUTE
          (PORT RN (::0.000))
          (PORT CK (::0.000))
....
....

 

 

Pre-Layout Simulation


Pre-Layout Simulation은 layout하기 이전의 simulation에 해당한다.

 

이 단계에서는 게이트 딜레이만 들어간다.

 

Pre-Layout Simulation을 하기 위해서는 합성을 통해 생성된 netlist 파일, testbench 파일, Lib 파일(합성에 사용된 Lib)이 필요하다.

 

 

counter_test.v

`timescale 10ns/10ps
module counter_test;
reg clk, rst;
wire [7:0] count;

counter counter1(clk,rst,count);

`ifdef SDF_TEST
initial
begin
$sdf_annotate("./delays.sdf",counter_test.counter1,,"sdf.log","MAXIMUM");
end
`endif

initial
begin
clk=0;
rst=0;
#10 rst=1;
#1000 $stop;
end


always #1 clk=~clk;

endmodule

 

중간에 'ifdef를 통해 전처리 하는 부분이 있는 것을 확인할 수 있다.

$sdf_annotate("./delays.sdf",counter_test.counter1,,"sdf.log","MAXIMUM");
$sdf_annotate("[SDF 파일 경로 지정]","[testbench instance]","[timing 정보]","[logfile 저장경로]","[지연측정방식]");

 

$sdf_annotate의 파라미터는 위와 같이 5개를 받는다. 해당 annotate를 작성해야 pre_layout_simulation에서 delay 정보가 적용된다.

 

Simulation 실행 명령어

xrun [파일명] [파일명] ... -access +rwc -gui

 

counter.sh

counter_netlist.v
counter_test.v
slow_vdd1v0_basicCells.v
-access
+rwc
-gui

명령어를 직접 입력하여 실행 시킬수도 있지만 스크립트 파일을 생성하여 실행 할 수 있다.

 

스크립트 파일 실행 명령어

xrun -f counter.sh

 

 

스크립트 파일 or Simulation 명령어를 실행하면 위와 같이 xcelium이 실행되는 것을 확인할 수 있다.

counter_test 파일을 시뮬레이션 돌리게 되면 아래와 같은 시뮬레이션 화면이 나오는 것을 확인할 수 있다.

counter_test.v 파일이 시뮬레이션으로 실행되는 것을 확인할 수 있다.

 

Trouble Shooting


* Verilog 파일마다 TimeScale 작성 여부 확인 해야 한다.

 

??? : simulation 결과 딜레이 정보가 보이지 않는다 => counter 코드가 너무 간단해서 그런건가?

728x90