SV Code Example On VCS

Preface

Hello everyone, I’m Chu Shenghui. This is my first attempt at writing a technical blog entirely in English.

In this article, I will walk you through running a System Verilog example using VCS, along with the integration of a Makefile script.

  • SV code

    module test;
        int a;
        initial begin
            for(int i = 0;i<8;i++) begin
                a = i;
                $display(a);
            end
        end
    endmodule
    
  • examine the code :vlogan -full64 -sverilog -l comp.log -kdb test.sv

  • Compile the code:

    vcs -full64 -sverilog test.sv -l com.log
    

    Upon success, the following files will appear:

ㅤ ㅤㅤㅤㅤ ㅤㅤㅤㅤ ㅤㅤㅤㅤ ㅤㅤㅤSV Code Example On VCS_第1张图片

  • Simulate

    ./simv -l sim.log
    

ㅤ ㅤㅤㅤㅤ ㅤㅤㅤㅤ ㅤㅤSV Code Example On VCS_第2张图片
Upon success, the following files will apper,By opening the sim.log, you can also view the results above.
ㅤ ㅤㅤㅤㅤ ㅤㅤㅤㅤ ㅤㅤㅤㅤ ㅤㅤㅤSV Code Example On VCS_第3张图片

Create Makefile script:

file.listfine -name "*.sv" > file.list

all:clean com sim

com:
	vcs -full64 -sverilog -f file.list -l comp.log
sim:
	./simv -l sim.log
clean:
	rm -rf ./csrc *.daidir *.log *.vpd *.vdb simv* *.key *race.out*
	rm -rf AN.DB
	rm -rf novas*
	rm -rf DVEfiles
	rm -rf urgReport

Makefile without using file.list

FILE=test.sv

all:clean com sim

com:
	vcs -full64 -sverilog  ${FILE} -l comp.log
sim:
	./simv -l sim.log
clean:
	rm -rf ./csrc *.daidir *.log *.vpd *.vdb simv* *.key *race.out*
	rm -rf AN.DB
	rm -rf novas*
	rm -rf DVEfiles
	rm -rf urgReport

你可能感兴趣的:(学无止境,fpga开发)