【问题标题】:How to constrain integer in VHDL 2008如何在 VHDL 2008 中约束整数
【发布时间】:2016-08-10 15:12:16
【问题描述】:

我想限制记录中的变量。这个变量是test_vector中的id_dd(记录)

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)

如何使用 subtype 约束 id_dd?

【问题讨论】:

    标签: vhdl


    【解决方案1】:

    根据 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 供应商严格实施的遗漏吗?或者还有什么好的理由?我很想知道。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-14
      • 2013-07-14
      • 1970-01-01
      • 2016-11-09
      相关资源
      最近更新 更多