Main Content

bitand

Bitwise AND of two fi objects

Description

c = bitand(a,b) returns the bitwise AND of fi objects a and b in fi object c.

The numerictype properties associated with a and b must be identical. If both inputs have a local fimath object, the fimath objects must be identical. If the numerictype is signed, then the bit representation of the stored integer is in two's complement representation.

a and b must have the same dimensions unless one is a scalar.

bitand only supports fi objects with fixed-point data types.

example

Examples

collapse all

Create a truth table for the logical AND operation.

A = fi([0 1; 0 1]);
B = fi([0 0; 1 1]);
TTable = bitand(A, B)
TTable = 

     0     0
     0     1

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 16
        FractionLength: 14

bitand returns 1 only if both bit-wise inputs are 1.

Input Arguments

collapse all

Input values, specified as scalars, vectors, matrices, or multidimensional arrays.a and b must have the same dimensions unless one is a scalar. Inputs a and b must be fi objects with fixed-point data types and identical numerictype properties. If both inputs have a local fimath object, the fimath objects must be identical.

Data Types: fi

Extended Capabilities

HDL Code Generation
Generate VHDL, Verilog and SystemVerilog code for FPGA and ASIC designs using HDL Coder™.

Version History

Introduced before R2006a

See Also

| | | |