Altera_Forum
Honored Contributor
11 years agoHow to latch a register value assigned in present state until next state?
Hi:):),
I'll be grateful and appreciate if somebody can help me to solve my problem. I'm a dummy in verilog and FPGA. Currently, I'm using Altera Cyclone IV to develop a IO card with PCI bus interface. I develop my code using state machine.. In my design, there have a simple acknowledgement handshaking between the PC and my firmware. When there is a command received from PC, the command will be decode in firmware and doing a particular task. Once the task is completed, a specific value, e.g. 0x80 (defined as "acknowledgment" ) is assigned to a register. This register is expected to hold 0x80 value until this value is being read by PC. The problem that I facing is that: The register with value 0x80 can hold its value only in the state where it being assigned to this value. This value no longer valid for next state. As I understanding for reg data type in verilog/system verilog: They retain their value till next value is assigned to them. I wondering what's wrong in my code causing such weird behaviour of register. The original source code file and signaltap file are attached together in this thread. I'm really look forward and appreciate somebody can look into my code and point out the wrong part to clear my doubts. Thank you!:-P