how to write verilog coding for decimal value

Status
Not open for further replies.

siva_7517

Full Member level 2
Joined
Jan 16, 2006
Messages
138
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Activity points
2,401
variable real verilog

Hi,

I am currently designing a fast fourier transform (FFT) chip. Meanwhile, I have across with decimal value while doing the calculation on FFT. Example :

x(1) = a - 0.707c + 0.707d

How can i represent the value 0.707 in verilog coding?

thanx
 

real variable verilog

real delta;//define a real variable
initial
begin
delta=707e-3; //delta assigned in scientific notation.
delta=0.707; //delat assigned a value 0.707
end
 

how to represent real values in verilog

i think you should transfer the decimal to binary.
x(1) = a - 0.707c + 0.707d
example if your define a reg [15:0] para to keep 0.707
0.707 =>65536*0.707 =46333.952=46334.
when you finished your compute , you can right shift 16 bit
 
Reactions: dipin

    dipin

    Points: 2
    Helpful Answer Positive Rating
verilog decimal

Hi,

But this coding below is non-synthesizeable. I think this coding is used for testbench.
Correct me if im wrong.

real delta;//define a real variable
initial
begin
delta=707e-3; //delta assigned in scientific notation.
delta=0.707; //delat assigned a value 0.707
end

Thanks
 

handling real values in verilog

you can use
1000*x(1) = 1000*a - 707c + 707d
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…