Could you explain this resize function?

Guest
Hi,

The following code (for a decimation rate 2 FIR) is generated from Matlab Coder:




wire signed [29:0] sumofproducts; // sfix30
wire signed [55:0] sumofproducts_cast; // sfix56


// Add the products in linear fashion

assign sumofproducts = product;

// Resize the sum of products to the accumulator type for full precision addition

assign sumofproducts_cast = $signed({{26{sumofproducts[29]}}, sumofproducts});



I find the last line is difficult to understand. I suppose that it should be resize sumofproducts from 30 bits to 56 bits. Does the above line make a cascade of sumofproducts?

Could you explain it to me?

Thanks,
 
On Saturday, March 29, 2014 2:35:29 PM UTC-4, rxj...@gmail.com wrote:
Hi,



The following code (for a decimation rate 2 FIR) is generated from Matlab Coder:









wire signed [29:0] sumofproducts; // sfix30

wire signed [55:0] sumofproducts_cast; // sfix56





// Add the products in linear fashion



assign sumofproducts = product;



// Resize the sum of products to the accumulator type for full precision addition



assign sumofproducts_cast = $signed({{26{sumofproducts[29]}}, sumofproducts});







I find the last line is difficult to understand. I suppose that it should be resize sumofproducts from 30 bits to 56 bits. Does the above line make a cascade of sumofproducts?



Could you explain it to me?



Thanks,

Thanks, I understand it now. It does extend the sign bit for 26 bits.
 

Welcome to EDABoard.com

Sponsor

Back
Top