2009-06-29 4 views
0

나는 Specman을 다음 코드 한 :이 두 번 x에 할당을 작성하는 낭비 이제specman에서 변수에 대한 참조를 만들려면 어떻게해야합니까?

var x := some.very.long.path.to.a.variable.in.another.struct; 

while (x == some_value) { 
    //do something that uses x; 
    //wait for something 

    //get a new value for x 
    x = some.very.long.path.to.a.variable.in.another.struct; 
}; 

보인다; 초기화 중에 한 번, 루프 중에 한 번.

var x := reference to some.very.long.path.to.a.variable.in.another.struct; 

while (x == some_value) { 
    //do something that uses x; 
    //wait for something 
    //no need to update x now since it's a reference 
}; 

이는 Specman을 수행 할 수 있습니다 내가 할 수 있도록

는 내가 정말 사용하려는 것은, 긴 변수 이름에 대한 참조입니다?

답변

1

specman/e는 일반적으로 구조체 및 목록에 대한 참조를 사용하므로 변수 유형이 둘 중 하나 인 경우 두 번째 예제가 작동해야합니다. integer 또는 boolean에 대해서는 변수에 대한 참조를 사용하는 방법을 모르겠습니다. 당신은이에 대한 몇 가지 자세한 정보를 찾을 수 있습니다 :

  1. 다른 구조체에 대한 포인터를 추가하고 설정 파일에 바인딩 : 어쨌든,이 개 아이디어는 당신을 도울 수있는

    struct a { other_variable : uint; }; 
    struct b { 
        other_struct : a; 
        some_func() is { 
         var x : uint = other_struct.other_variable; 
         while (x == some_value) { 
          x = other_struct.other_variable; 
         }; 
        }; 
    }; 
    extend cfg { 
        struct_a : a; 
        struct_b : b; 
        keep struct_b.other_struct == struct_a; 
    }; 
    

    UPDATE 기술에 this Team Specman Post.

  2. 은 (help pass reference 참조) 참조로 매개 변수를 전달할 수있다, 함수에서 while 루프를 랩 :

    some_func(x : *uint) is { 
         while (x == some_value) { 
          // stuff ... 
         }; 
        }; 
    

희망이 도움이!

다니엘

관련 문제