Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Real Number

Altera_Forum
Honored Contributor II
1,032 Views

Why run into the following test results inaccurate? 

 

//first p 

module real_number; 

 

parameter a=1.2; 

parameter b=1.5; 

assign c=a+b; 

initial begin 

$display ("result is:",c); 

# 10 $finish; 

end 

endmodule 

 

result: x 

 

but when running the program: 

 

module real_number; 

 

parameter a=1.2; 

parameter b=1.5; 

//assign c 

initial begin 

$display ("result is:",a+b); 

# 10 $finish; 

end 

endmodule 

 

we obtain accurate results: 3.7 

if you want to write the program first, then how to write? 

thanks!!!
0 Kudos
0 Replies
Reply