Unsigned subtracted by Natural VHDL

Discussion in 'Hardware' started by caosjr, Jun 12, 2014.

  1. caosjr


    Jun 12, 2014
    Likes Received:
    Hi guys,

    I am implementing CORDIC for floating point, and I have a problem with the subtraction between UNSIGNED type and NATURAL. I tested on Modelsim and the result is completely different from I what I expected. For example

    "01111111111" - 1023
    "11111111101" - 2045

    all the variables are UNSIGNED and i is NATURAL RANGE 0 to 31. I'm doing this because I need to divide the value of new_y by power of 2, I can't use shift because this is the exponent, so I have to subtract by 1, 2, 4, 8 ... 2^31. Can you help me?

    exp_y := new_y(word_size-2 DOWNTO mantissa);
    exp_y := exp_y - i;
    new_x <= arith_operation_float(new_x, shifted_y);

    Attached Files:

    caosjr, Jun 12, 2014
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.