4. Software Driven Verification
● ソフトウェア(プログラム)を使って、ハードウェア(RTL等)を検証する
DUT (Design under Test)
RTL等で記述
Model
Driver/Checker/Monitor
Test Program
Top Test Bench
5. SystemVerilogでは?
● UVM (Universal Verification Methodology) : UVM 2020-1.1
DUT (Design under Test)
SystemVerilog
Model
SystemVerilog
Test Program
SystemVerilog
Top Test Bench
(SystemVerilog)
現状、商用HDLシミュレータのみ利用可能
6. Verilator とは? (https://github.com/verilator)
Welcome to Verilator, the fastest Verilog/SystemVerilog simulator.
● Accepts synthesizable Verilog or SystemVerilog
● Performs lint code-quality checks
● Compiles into multithreaded C++, or SystemC
● Creates XML to front-end your own tools
テストベンチ側に、
● マルチスレッドな C++
● SystemC
が使える
9. Verilatorでは?
● DUTは、SystemVerilog の RTL記述のみ使える
DUT (Design under Test)
SystemVerilog RTL
Model
C++/SystemC
Test Program
C++/SystemC
Top Test Bench
(C++/SystemC)
10. Verilator + SystemC
● DUTは、SystemVerilog の RTL記述のみ使える
DUT (Design under Test)
SystemVerilog RTL
Model
SystemC
Test Program
C++
Top Test Bench
(SystemC)
12. Verilator + SystemC
● DUT(Memory)にアクセスするケース
DUT (Memory)
SystemVerilog RTL
Bus Functional Model
SystemC
Test Program
SystemC
Top Test Bench
(SystemC)
● Read
● Write
13. module top // Memory だけど、Verilatorの慣習で top にしています
(
input logic clk,
input logic reset,
input logic [15:0] addr,
input logic cs,
input logic rw,
input logic [31:0] data_in,
output logic ready,
output logic [31:0] data_out
);
localparam ram_size = (17'h10000>>2);
logic [31:0] ram[ram_size];
enum {STATE_IDLE, STATE_RUN, STATE_DONE} state;
always_ff @(posedge clk) begin
if(reset == 1'b1)
state <= STATE_IDLE;
else if(cs == 1'b1 && state == STATE_IDLE)
state <= STATE_RUN;
else if(cs == 1'b1 && state == STATE_RUN)
state <= STATE_DONE;
else if(cs == 1'b0)
state <= STATE_IDLE;
end
DUT (Memory)
always_ff @(posedge clk) begin
if(reset == 1'b1) begin
data_out <= 32'h0000_0000;
ready <= 1'b0;
end
else if(state == STATE_RUN) begin
if(rw == 1'b1)
data_out <= ram[addr[15:2]];
else
ram[addr[15:2]] <= data_in;
ready <= 1'b1;
end
else begin
data_out <= 32'h0000_0000;
ready <= 1'b0;
end
end
endmodule
19. Verilator + SystemC
● Test Program を別ファイルにして、いろいろなテストができる
DUT (Memory)
SystemVerilog RTL
Bus Functional Model
SystemC
Test Program
SystemC
Top Test Bench
(SystemC)
● Read
● Write
Test Program
SystemC
Test Program
SystemC
Test Program
SystemC
Test Program
SystemC
Test Program
SystemC
Test Program
SystemC
Test Program
SystemC
Test Program
SystemC
21. Verilator + SystemC + SystemVerilog DPI
● SystemVerilogのDPIを使うと、DUTの中に直接アクセスできる
DUT (Memory)
SystemVerilog RTL
Bus Functional Model
SystemC
Test Program
SystemC
Top Test Bench
(SystemC)
● Read
● Write
Test Program
SystemC
Test Program
SystemC
Test Program
SystemC
Test Program
SystemC
Test Program
SystemC
Test Program
SystemC
Test Program
SystemC
Test Program
SystemC
SystemVerilog DPI