assignment of a real value to a register... - verilog

This is a discussion on assignment of a real value to a register... - verilog ; Hi, If I have 2 definitions in my verilog code: reg [31:0] result; real fp_result; then can I do the following (and synthesize)? // Compute the value of fp_result.... //DO the following assignment... always @(posedge clk) result <= fp_result; Thanks, ...

+ Reply to Thread
Results 1 to 3 of 3

assignment of a real value to a register...

  1. Default assignment of a real value to a register...

    Hi,

    If I have 2 definitions in my verilog code:

    reg [31:0] result;
    real fp_result;

    then can I do the following (and synthesize)?

    // Compute the value of fp_result....

    //DO the following assignment...

    always @(posedge clk)
    result <= fp_result;



    Thanks,

    Kb33


  2. Default Re: assignment of a real value to a register...

    On 21 Apr 2006 13:14:35 -0700, "kb33" <kanchan.devarakonda@gmail.com>
    wrote:

    >If I have 2 definitions in my verilog code:
    >
    >reg [31:0] result;
    >real fp_result;
    >
    >then can I do the following (and synthesize)?
    >
    >// Compute the value of fp_result....
    >
    >//DO the following assignment...
    >
    >always @(posedge clk)
    > result <= fp_result;


    The reals in verilog are double precision so your reg has to be 64
    bits and if you want to access the value of a real you need to use
    $realtobits before you can copy it to a reg. But reals are not
    synthesizable so you have to implement your own floating point
    operators anyway.

  3. Default Re: assignment of a real value to a register...


    Use "realtobits()" system function to accomplish the job

    Joe
    LogicSim - Your Personal Verilog Simulator
    http://www.logicsim.com

    kb33 wrote:
    > Hi,
    >
    > If I have 2 definitions in my verilog code:
    >
    > reg [31:0] result;
    > real fp_result;
    >
    > then can I do the following (and synthesize)?
    >
    > // Compute the value of fp_result....
    >
    > //DO the following assignment...
    >
    > always @(posedge clk)
    > result <= fp_result;
    >
    >
    >
    > Thanks,
    >
    > Kb33



+ Reply to Thread

Similar Threads

  1. Replies: 0
    Last Post: 09-03-2007, 02:40 PM
  2. Replies: 0
    Last Post: 09-03-2007, 02:40 PM
  3. Replies: 0
    Last Post: 09-03-2007, 02:40 PM
  4. Replies: 0
    Last Post: 09-03-2007, 02:10 PM
  5. extracting register value from real value..
    By Application Development in forum verilog
    Replies: 2
    Last Post: 04-27-2006, 11:14 AM