a newbie's question on the serial project

FPGA projects on this site, or abroad

a newbie's question on the serial project

Postby anthonius » Thu Jul 26, 2007 9:22 pm

Hi everyone,

I am very new to HDL and have a question about reg data type nitialization in the serial interface project code.
When I tested RS-232 receiver code, I found that regs like Baud8GeneratorAcc and RxD_cnt_inv are always in an unknown state (xxxx for example).
I found the reason is that they were never initialized to a value before they were incremented in a expression like reg = reg + a_value. After I initialized the regs to 0, the code worked correctly.
My questions is that does the code run correctly (without the initializations) in anybody else's simulator, and maybe with a different setting? Also, is it good style to explicitly initialize a reg to a value after declaration?

thanks,
Tony Huang
anthonius
 
Posts: 1
Joined: Thu Jul 26, 2007 6:12 pm
Location: Toronto, Canada

Postby fpga4fun » Fri Sep 21, 2007 5:40 am

Yes, the initializations don't matter for synthesis but are required for simulation.
fpga4fun
Site Admin
 
Posts: 837
Joined: Thu Sep 18, 2003 6:47 am


Return to General projects