Forum Discussion
Altera_Forum
Honored Contributor
9 years ago --- Quote Start --- Tricky, I am not sure you are right here. cnt is used before assigning it to itself so a register should be generated for the variable. so enable should work and takes priority over load. I know for sure such counters work with variables. Though I personally use variables very occasionally. I think the problem may be in the last statement outside clk edge. --- Quote End --- But the enable overrides load, because they are two separate ifs. So actually its a 3:1 priority mux with cnt+1, new_data or cnt. So while I agree I was initially wrong, and it should work with the cnt variable, the fact it's two separate ifs and not an elsif will be the problem.