Main Content

bitreplicate

Replicate and concatenate bits of fi object

Syntax

c = bitreplicate(a,n)

Description

c = bitreplicate(a,n) concatenates the bits in fi object a n times and returns an unsigned fixed-point value. The word length of the output fi object c is equal to n times the word length of a and the fraction length of c is zero. The bit representation of the stored integer is in two's complement representation.

The input fi object can be signed or unsigned. bitreplicate concatenates signed and unsigned bits the same way.

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

bitreplicate does not support inputs with complex data types.

Sign and scaling of the input fi object does not affect the result type and value.

Examples

The following example uses bitreplicate to replicate and concatenate the bits of fi object a.

a = fi(14,0,6,0);
a_binary = a.bin
c = bitreplicate(a,2);
c_binary = c.bin

MATLAB® returns the following:

a_binary =

001110


c_binary =

001110001110

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

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

Version History

Introduced in R2008a