I am implementing four-bit-counter but I am getting value of x for Port_co unter in auto-counting.
formatting link
(VHDL code) and http:/ /pastebin.com/2kY3hQAN (testbench). I already finished the two flip-flop in VHDL. I am now stuck with simulation.
formatting link
Someone told me that the usual reason for an undefined output is failure t o initialize all signal. So, I uncommented the clock_enable process and ch ange the VHDL source to
formatting link
,but simulation just w on't stop. Did I code my clock_enable process correctly?
even after I manually stop the simulation, the waveform window is EMPTY
I am implementing four-bit-counter but I am getting value of x for Port_cou nter in auto-counting.
formatting link
(VHDL code) and http:// pastebin.com/2kY3hQAN (testbench). I already finished the two flip-flop in VHDL. I am now stuck with simulation.
formatting link
Someone told me that the usual reason for an undefined output is failure to initialize all signal. So, I uncommented the clock_enable process and cha nge the VHDL source to
formatting link
,but simulation just wo n't stop. Did I code my clock_enable process correctly?
even after I manually stop the simulation, the waveform window is EMPTY
You are making this far too complex. You have one output signal, Port_Counter. You only need one process to drive that output. A signal should not be driven from more than one process or you get a error.
If you have intermediate signals to make your code simpler, you can define those in separate processes, but I don't think that is needed here. There are a lot of inputs which you don't say how they are used. I suggest you start with a simple enabled 4 bit counter and ignore the rest of the inputs for now. Then add code to add the functionality needed for the other inputs.
You see no waveforms in simulation likely because you have not added any waveforms to the display. There should be a control somewhere to add
*all* the signals to the waveform display. Or you can add them one at a time. You didn't say which simulator you are using. If it is not ActiveHDL I can't help you with that. I suggest you run the simulation for a fixed amount of time rather than expecting it to stop. The clock will prevent the simulation from ever stopping on its own.
Your clock_enable process has no sensitivity list. This is OK for synthesis, but in simulation it causes an endless loop since there are no wait statements. If you had coded it as: wait until rising_edge(clk) instead of if rising edge (clk) then the simulation would advance. As written, you should have clk in the sensitivity list. Otherwise simulation will be stuck at time zero.
Also heed Rick's advice if you intend to synthesize this code.
If the requirement is to use an async load, then that is the requirement.
Again, you are assigning a signal in two processes. The async and sync logic need to be in the same process. BTW, they way you coded this, your reset is synchronous, not async. Just a practical note, in FPGAs a fixed value can be loaded asynchronously (that makes it the same as a pre/reset). But a signal can not be assigned to a FF asynchronously. It is *very* seldom this would ever be a requirement. This is just an exercise...
process(clk, load) begin -- everything before the if(rising_edge(... is async if (load = '1') then temp
What are you synchronising? I presume this is the load input? If so then your load signal is no long an asynchronous signal and can implement a more reliable synchronous load.
A signal should only be defined in a single process. If you assume that you won't go wrong in that respect. As an example your 'temp' is assigned a value in two independent processes. It's like a contention in hardware.
--
Mike Perkins
Video Solutions Ltd
www.videosolutions.ltd.uk
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.