2016-12-14 8 views
0

기대 : mem_type 문자열 및 MEM 클래스의 구성원 인 기대UVM - 오류 - 근처 ":": 구문 오류, 예기치 않은 ':', 난 내 자신의 my_macros 파일을 만들 식별자 또는 시계

`ifndef MY_MACROS_SV 
`define MY_MACROS_SV 

// MACRO: 'my_fatal_err 
// calls uvm_fatal in case the assertion is not correct 
`define my_fatal(condition, msg)\ 
    assert (condition) else\ 
`uvm_fatal("FATAL ERROR", msg)\ 
\ 
`define add_rand(mem_type, mem)\ 
    case (mem_type)\ 
    "int": add_rand_int(mem);\ 
    "bit": add_rand_bit(mem);\  
    default: `uvm_fatal("FATAL ERROR", "type is not supported")\ 
    endcase 



`endif //MY_MACROS_SV 

합니다. 다음과 같은 컴파일 오류가 발생했습니다.at .. \ sv \ my_macros.sv (19) : ":"근처 : 구문 오류, 예기치 않은 ':', IDENTIFIER 또는 clock이 필요합니다.

*이 라인 (19)은 "기본 : ..."입니다

+0

당신이해야 모든 사람을 인식 할 때 여러 사이트에 당신이 교차 질문을 게시 :은 https ://verificationacademy.com/forums/uvm/error-near-begin-syntax-error-unexpected-begin-expecting-function-or-task. – toolic

답변

0

분리하여 2 개 매크로 :

`ifndef MY_MACROS_SV 
`define MY_MACROS_SV 

// MACRO: 'my_fatal_err 
// calls uvm_fatal in case the assertion is not correct 
`define my_fatal(condition, msg)\ 
    assert (condition) else\ 
`uvm_fatal("FATAL ERROR", msg) 

`define add_rand(mem_type, mem)\ 
    case (mem_type)\ 
    "int": add_rand_int(mem);\ 
    "bit": add_rand_bit(mem);\  
    default: `uvm_fatal("FATAL ERROR", "type is not supported")\ 
    endcase 



`endif //MY_MACROS_SV