ombadei
Member level 3
- Joined
- Sep 1, 2008
- Messages
- 62
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Activity points
- 1,754
process (clkin)
begin
a <= b;
end process;
ombadei said:Ok.. I am a bit confused now.. is this dependent on the tool that is used?
So, what about this situation where a and b are signals in the below code and clkin is a free running clock?
Code:process (clkin) begin a <= b; end process;
process (clkin)
begin
if rising_edge(clkin)
a <= b;
end if;
end process;
process (clkin,b)
begin
a <= b;
end process;
Supplementing the clear explanation by omara007, I doubt, that it depends on the tools. Using the sensitivity list as shown, you can expect that the code is understood correctly by any tool, either in synthesis or simulation.is this dependent on the tool that is used?
FvM said:2. In a process, you can have multiple assignment to a signal, e.g. clkout. While this would be flagged out as a mutiple-source error in combinational code, it's legal in sequential code. Simply, the last assignment wins.
process (clk,b)
begin
if clk'event and clk = '1' then
b <= b + 1;
if b = 10 then
b <= (others => '0');
end if;
end if;
end process;
ombadei said:FvM said:2. In a process, you can have multiple assignment to a signal, e.g. clkout. While this would be flagged out as a mutiple-source error in combinational code, it's legal in sequential code. Simply, the last assignment wins.
Just to clarify on the "last assignment wins".. does such a situation arises for signal b when the below code is executed?
Code:process (clk,b) begin if clk'event and clk = '1' then b <= b + 1; if b = 10 then b <= (others => '0'); end if; end if; end process;
if rising_edge(clk) then
if b <= 10 then
b <= b+1;
elsif b = 10 then
b <= 0;
end if;
end if;
Looks like i have to filter my large code and change the way i do my loop control in my application.If you want the counter to reset when reaches 10, code it like this:
also, don't mix between using (others => '0') and integer (10). Either you use (10, 0) .. or ("1010", '0').
b <= conv_unsigned (10,4); or
b <= "1010"; or
b <= x"A";
if b = 10 then
if b = conv_unsigned(10,4) then
if rising_edge(clk) then
case curState is
.
when st01 =>
nextState <= st02;
when st02 =>
dataOut <= dataIn; -- Capture Data
if b <= 10 then
b <= b+1;
nextState <= st02;
elsif b = 10 then
b <= 0;
nextState <= st03;
end if;
when st03 =>
.
end if;
U_DATA:
process (clk)
begin
if rising_edge(clk) then
dataOut <= dataIn;
end if;
end process;
The elsif condition is never true and the state machine caught in st02.when st02 =>
dataOut <= dataIn; -- Capture Data
if b <= 10 then
b <= b+1;
nextState <= st02;
elsif b = 10 then
b <= 0;
nextState <= st03;
end if;
FvM said:The elsif condition is never true and the state machine caught in st02.
if rising_edge(clk)
case curstate is
when st0 => nextst <= st1;
when st1 =>
if a = '1' then
nextst <= st1;
else
if b = '1' then
nextst <= st2;
else
nextst <= st3;
end if;
end if;
when st2 => ..
when st3 => ..
end if;
The syntax isn't valid for std_logic_vector. The problem is, that b<=10 includes b=10, so the second condition isn't evaluated at all.For a signal std_logic_vector, it will get caught in st02?
For a signal integer, it doesn't get caught in st02?
The syntax isn't valid for std_logic_vector.
I don't understand, what you mean with a threshold in this case. All if levels are evaluated, generally. There's no limit for their complexity.
The behaviour is completely deterministic. I don't see anything unclear with the nested if statements. They are evaluated left to right.do i have a sense of control in how my state machine behaves.
There is a difference, that integer hasn't a defined bit width. But I in the example, I simply refered to different syntax for numeric constants. That's not fundamental, but a difference.That means there's still a fundamental difference between signal integers and signal std_logic_vector.
There are different opinions about better using legacy std_logic_arith or more recent numeric_std libraries. Basically, both are working. If you are starting a new project and don't have to deal with old libraries, you should go for numeric_std.I understand that there are some complications in using the 'numeric' versus 'arith' packages.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?