Non-integer values in verilog -



Non-integer values in verilog -

is there way store , compute non-integer values in verilog, (say x = 5/2 = 2.5 ). can compute , store 2.5 in x defined above?

yes, can utilize real registers store real values, i.e.:

real float; // register store real value

usually it's 64-bit wide info type stores floating-point values. not verilog operators can used look involving real numbers , real registers. concatenations, modulus operator, case equality, bit-wise operators, reduction operators shift operators, bit-selects , part-selects on real type variables not allowed.

simple example:

module ecample; real r; initial begin r = 123456e-3; $display("r=%f",r); // r = 123.456000 #20 r = r / 2; $display("r=%f",r); // r = 61.728000 $finish; end endmodule

verilog system-verilog hdl

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -