Re: VHDL Newbie - Is this a valid statement?



Hi Nigel,
your source snippet seems to be ok. If your design isn't time critical you can leave it the way it is.

To use a reset inside a design as a control signal is a philosophical question.
But doing the compare inside your fsm increases the number of inputs unnecessary. Better do that inside your counter and generate a (synchronous) CountEnd signal there. This may speed up your FSM a little.


Comparing signals to constants is very common in VHDL. If your counter has only four bits anyway it's sufficient to write
if(counter_q = "1101") THEN
...
end if;

One thing that may bother you is the chosen value. Is cnt_rst a synchronous or an asynchronous input to the counter? If it's a synchronous reset your counter may stay one count behind the expected value (pipelinig effect, check your simulation). To overcome this you can simply reduce the compare constant.

have a nice synthesis
Eilert




nigel502@xxxxxxxxx schrieb:
Hello,

My goal is to make a step in my FSM that loops until my counter reaches
it's desired value and then moves to it's next step - however I am
having issues detecting it reaching that desired value. I'm assuming
that something is wrong with my conditional statement. Can you compare
a signal against a constant value in VHDL

signal counter_q: std_logic_vector(3 downto 0);
.....
when read_del =>

cnt_rst <='0'; -- signal to reset counter - keep low here

if(counter_q(3 downto 0) = "1101") THEN
next_state <= blah;
else
next_state <= read_del;
end if;

What is the proper way to preform this action?

Thanks in advance

.



Relevant Pages

  • Re: Need to force all signals in a design to a known value at start of simulation
    ... I have a VHDL design which has no reset, ... works ok on the board as in the real world all signals have a default ... I don't suppose we need to tell you that having neither reset nor ... initializers is a bad design practice, even when it "works" in FPGA ...
    (comp.arch.fpga)
  • Need to force all signals in a design to a known value at start of simulation
    ... I have a VHDL design which has no reset, ... works ok on the board as in the real world all signals have a default ...
    (comp.arch.fpga)
  • Re: Mixed clocked/combinatorial coding styles
    ... signals, ... some unachievable decoupling. ... During the design process where you're still working on what the ... Hierarchy is best expressed wherever you can express it. ...
    (comp.lang.vhdl)
  • Re: spartan 3an application
    ... When this signals is one, you count up and if it's 0 you count down. ... RESET, //input button ... reg Qreset; ... wire PULSE_NEW_out; ...
    (comp.lang.verilog)
  • Re: SI and EMI training
    ... signals require 4 different power supplies (an entire EMC/EMI issue in ... few extra caps into the thing. ... I had a device (one of the x-point switches in the above design as it ... That has little to do with decoupling, ...
    (comp.arch.embedded)