Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Analysis of code: issue with assigning COUNT

Status
Not open for further replies.

mmurali

Newbie level 3
Joined
Mar 22, 2006
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,340
Analysis of code

I got this code from a fellow designer.

process (CLK, RES_N)
begin

if RES_N = '0' then

COUNT <= "00000000";
SOP_INT <= '0';
EOP_INT <= '0';

elsif rising_edge(CLK) then
if ENABLE = '1' then
COUNT <= COUNT + 1;
if SYNC_SIG = '1' then
COUNT <= "00000000";
SOP_INT <= '0';
EOP_INT <= '0';
elsif START_SIG = '1' then
COUNT <= "00000001";
SOP_INT <= '1';
EOP_INT <= '0';
elsif COUNT >= "11111110" then
SOP_INT <= '0';
EOP_INT <= '1';
else
SOP_INT <= '0';
EOP_INT <= '0';
end if;
end if;
end if;

If you notice he's assigned COUNT outside of the lower if condition instead of doing it within the 'else' condition. Is this code ok? I'm a bit concerned as to how the synthesis tool will interpret this code. If start_sig = '1' then COUNT will have two logic paths. In VHDL does the if statement behave like a case statement where there is default statement on top.
Thanks.
 

Re: Analysis of code

The code looks OK!
Yes here also if statement behave like a case statement where there is default statement on top.
 

    mmurali

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top