2016-08-09 33 views
1

我想限制記錄中的變量。這個變量是id_ddtest_vector(記錄)如何約束VHDL 2008中的整數

type test_vector is record 
      id_dd : integer; 
      stimulus : bit_vector; 
      response : bit_vector; 
     end record test_vector; 

type test_time is record 
      stimulus_time : time; 
      response_delay : delay_length; 
     end record test_time; 

type test_application is record 
      test_to_apply : test_vector; 
      application_time : test_time; 
     end record test_application; 

subtype schedule_test is test_application (test_to_apply ( id_dd (0 to 100) , 
                  stimulus (0 to 7), 
                  response(0 to 9))); 

Modelsim的錯誤是:

Constraint for record element "test_vector.id_dd" (at depth 1) cannot apply to non-composite type (std.STANDARD.INTEGER) 

我怎麼能限制id_dd使用亞型

回答

0

根據LRM:

record_constraint ::= 
    (record_element_constraint { , record_element_constraint }) 

record_element_constraint ::= 
    record_element_simple_name element_constraint 

element_constraint ::= 
    array_constraint 
    | record_constraint 

正如你所看到的,一個元素約束不能是range_constraint,只有array_constraintrecord_constraint。我沒有找到關於這個限制的解釋。這可能是EDA供應商嚴格實施的遺漏嗎?還是有另一個很好的理由?我有興趣知道。