Vector bit selects and part selects

Source: Internet
Author: User

 

• A bit select can be an integer, a constant, a net, a variable or an expression.
• A constant part select is a group of bits from within the Vector
• The part select must be contiguous bits.
• The bit numbers must be a literal number or a constant.
• The Order of the part select must be consistent with the declaration of Vector (e.g. If the LSB is the lowest Bit number in the declaration, then The lsb of the part select must also be the lowest Bit number ).
• Variable part selects can vary the starting point of the part select, but Width of the part select must be a literal number, a constant or a call to Constant function. variable part selects were added in Verilog-2001.
• +: Indicates the part select increases from the starting point.
• -: Indicates the part select decreases from the starting point.

 

Examples:
Reg [31: 0] big_vect;
Reg [0: 31] little_vect;
Reg [63: 0] DWORD;
Integer sel;
The specified rst four if statements show the identity between the two part select constructs. The last one shows Indexable nature.
Initial begin
If (big_vect [0 +: 8] = big_vect [7: 0]) Begin end
If (little_vect [0 +: 8] = little_vect [0: 7]) Begin end
If (big_vect [15-: 8] = big_vect [15: 8]) Begin end
If (little_vect [15-: 8] = little_vect [8: 15]) Begin end
If (SEL> 0 & sel <8) DWORD [8 * sel +: 8] = big_vect [7:0];
// Replace the byte selected.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.