Jump to content

Search the Community

Showing results for tags 'sum'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Accellera Systems Initiative
    • Information
    • Announcements
    • In the News
  • SystemC
    • SystemC Language
    • SystemC AMS (Analog/Mixed-Signal)
    • SystemC TLM (Transaction-level Modeling)
    • SystemC Verification (UVM-SystemC, SCV)
    • SystemC CCI (Configuration, Control & Inspection)
    • SystemC Datatypes
  • UVM (Universal Verification Methodology)
    • UVM (IEEE 1800.2) - Methodology and BCL Forum
    • UVM SystemVerilog Discussions
    • UVM Simulator Specific Issues
    • UVM Commercial Announcements
    • UVM (Pre-IEEE) Methodology and BCL Forum
  • Portable Stimulus
    • Portable Stimulus Discussion
    • Portable Stimulus 2.0 Public Review Feedback
  • IP Security
    • SA-EDI Standard Discussion
    • IP Security Assurance Whitepaper Discussion
  • IP-XACT
    • IP-XACT Discussion
  • IEEE 1735/IP Encryption
    • IEEE 1735/IP Encryption Discussion
  • Commercial Announcements
    • Announcements

Categories

  • SystemC
  • UVM
  • UCIS
  • IEEE 1735/IP Encryption

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Biography


Location


Interests


Occupation


Company

Found 1 result

  1. Can a single constraint be used across an array of objects? i.e. affecting the relation between a property which exists in each of those objects? I'm trying to do something like an array reduction or sum, but instead of performing it on an array, performing it on the properties of objects in an array. My goal is to better understand the capabilities of constraints. Example below: (I do not show my failed attempts.) //Class animal_c has a property "weight". //A dynamic array is generated where each element points to an animal. //The cumulative weight of the animals should be 100. //How can this be done with constraints? //Can a constraint expression reference properties referenced by handles? // //My goal is to better understand contraints, so I attempt to stuff as much as possible into the constraints. module top; class animal_c; rand int weight; constraint weight_legal_c {weight>1; weight<40;} //allowed weight per animal. function void show(); $display("animal weight:%2d", weight); endfunction endclass class group_of_animals_c; rand animal_c animal_da[]; constraint number_of_animals_c { animal_da.size() inside {[3:5]}; } //As I understand, array objects cannot be constructed in the randomize call that determines the array size. (T or F?) //so, post_randomize seems the natural place to construct the objects in the array. function void post_randomize(); foreach(animal_da[iii]) begin animal_da[iii]=new(); //create each object of array assert(animal_da[iii].randomize()); end endfunction function void show_group(); foreach(animal_da[iii]) animal_da[iii].show(); endfunction endclass initial begin group_of_animals_c group_m; group_m = new(); assert(group_m.randomize()); group_m.show_group(); end endmodule https://www.edaplayground.com/x/4Dx5
×
×
  • Create New...