Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - Sequential Circuits power up Reset

 
Thread Tools Search this Thread
Old 06-30-2005, 05:02 PM   #1
Default Sequential Circuits power up Reset


Hello,

I am having a problem with the power up "Reset" of the 19-bit counter..
I want it to be "0000 hex", whenever, I power up my system.
It initializes it self to "0000hex" sometimes and sometimes it does not
do that. I have attached the code too. Please advice!

Thanks
Regards
John.


Address_bus<= sec_counter;
sec_counter<= "0000000000000000000" When Reset_A ='1' Else sec_counter
+ 1 When inc 'Event And inc= '1' And sec_stop ='0';

sec_stop <= '1' When sec_counter(1='0'and sec_counter(17)='0'and
sec_counter(16)='0' and
sec_counter(15)='0'and sec_counter(14)='0'and sec_counter(13)='1' and
sec_counter(12)='0'and sec_counter(11)='0'and sec_counter(10)='1' and

sec_counter(9)= '0'and sec_counter(= '0'and sec_counter(7)='0' and

sec_counter(6) ='0'and sec_counter(5)= '1'and sec_counter(4)='0' and

sec_counter(3)= '0'and sec_counter(2)= '0'and sec_counter(1)='0' and
sec_counter(0)= '0'
Else
'0';
Process(State)

Begin

Case State is

When E0 =>
Reset_A <= '1';
nextstate<= E1;

When E1 =>
Reset_A <= '0';
nextstate<= E1;

When Others =>
Reset_A <= '1';
nextstate<= E0;


End Case;
End Process;
----

Process (State2)
Begin

Case State2 is


When G0=>
inc<='0';
Data_Bus ( 13 downto <= USB_Data ( 5 downto 0 );
UBL <='0';
LBL <='0';
nextstate2 <=G1;

When G1 =>
inc <='0';
Data_Bus ( 7 downto 0) <= USB_Data ( 7 downto 0 );
UBL <='0';
LBL <='0';

nextstate2<=G2;

When G2 =>
inc <='1';
Data_Bus ( 13 downto <= USB_Data ( 5 downto 0 );
UBL <='0';
LBL <='0';

nextstate2 <=G3;

When G3 =>
inc <='0';
Data_Bus ( 7 downto 0) <= USB_Data ( 7 downto 0 );
UBL <='0';
LBL <='0';

nextstate2 <=G2;
When others =>
nextstate2 <=G0;

End case;
End Process;

----

Process (USB_CLK )
Begin

If (USB_CLK 'Event And USB_CLK = '0')Then

If ( sec_stop= '0') Then

State2 <= nextstate2;
State <= nextstate;

Else
State2 <= G0;
State <= E0;

End If;

End If;

End Process;



john
  Reply With Quote
Old 06-30-2005, 05:43 PM   #2
Jonathan Bromley
 
Posts: n/a
Default Re: Sequential Circuits power up Reset
On 30 Jun 2005 09:02:25 -0700, "john" <> wrote:


>I am having a problem with the power up "Reset" of the 19-bit counter..
>I want it to be "0000 hex", whenever, I power up my system.
>It initializes it self to "0000hex" sometimes and sometimes it does not
>do that. I have attached the code too. Please advice!


Are you talking about behaviour of the real hardware, or simulation?
Have you simulated? Have you run synthesis? Are you sure that signal
Reset_A is indeed asserted at startup?

Did they teach you about.....

....synthesisable clocked processes?

>sec_counter<= "0000000000000000000" When Reset_A ='1' Else sec_counter
> + 1 When inc 'Event And inc= '1' And sec_stop ='0';


.... numeric comparison in the numeric_std package?

>sec_stop <= '1' When sec_counter(1='0'and sec_counter(17)='0'and
>sec_counter(16)='0' and
>sec_counter(15)='0'and sec_counter(14)='0'and sec_counter(13)='1' and
>sec_counter(12)='0'and sec_counter(11)='0'and sec_counter(10)='1' and
>
>sec_counter(9)= '0'and sec_counter(= '0'and sec_counter(7)='0' and
>
>sec_counter(6) ='0'and sec_counter(5)= '1'and sec_counter(4)='0' and
>
>sec_counter(3)= '0'and sec_counter(2)= '0'and sec_counter(1)='0' and
>sec_counter(0)= '0'
>Else
> '0';

--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL, Verilog, SystemC, Perl, Tcl/Tk, Verification, Project Services

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, BH24 1AW, UK
Tel: +44 (0)1425 471223 mail:
Fax: +44 (0)1425 471573 Web: http://www.doulos.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.


Jonathan Bromley
  Reply With Quote
Old 06-30-2005, 06:16 PM   #3
john
 
Posts: n/a
Default Re: Sequential Circuits power up Reset
Hello,
I am talking about real hardware behaviour.

Thanks
Regards
John

john wrote:
> Hello,
>
> I am having a problem with the power up "Reset" of the 19-bit counter..
> I want it to be "0000 hex", whenever, I power up my system.
> It initializes it self to "0000hex" sometimes and sometimes it does not
> do that. I have attached the code too. Please advice!
>
> Thanks
> Regards
> John.
>
>
> Address_bus<= sec_counter;
> sec_counter<= "0000000000000000000" When Reset_A ='1' Else sec_counter
> + 1 When inc 'Event And inc= '1' And sec_stop ='0';
>
> sec_stop <= '1' When sec_counter(1='0'and sec_counter(17)='0'and
> sec_counter(16)='0' and
> sec_counter(15)='0'and sec_counter(14)='0'and sec_counter(13)='1' and
> sec_counter(12)='0'and sec_counter(11)='0'and sec_counter(10)='1' and
>
> sec_counter(9)= '0'and sec_counter(= '0'and sec_counter(7)='0' and
>
> sec_counter(6) ='0'and sec_counter(5)= '1'and sec_counter(4)='0' and
>
> sec_counter(3)= '0'and sec_counter(2)= '0'and sec_counter(1)='0' and
> sec_counter(0)= '0'
> Else
> '0';
> Process(State)
>
> Begin
>
> Case State is
>
> When E0 =>
> Reset_A <= '1';
> nextstate<= E1;
>
> When E1 =>
> Reset_A <= '0';
> nextstate<= E1;
>
> When Others =>
> Reset_A <= '1';
> nextstate<= E0;
>
>
> End Case;
> End Process;
> ----
>
> Process (State2)
> Begin
>
> Case State2 is
>
>
> When G0=>
> inc<='0';
> Data_Bus ( 13 downto <= USB_Data ( 5 downto 0 );
> UBL <='0';
> LBL <='0';
> nextstate2 <=G1;
>
> When G1 =>
> inc <='0';
> Data_Bus ( 7 downto 0) <= USB_Data ( 7 downto 0 );
> UBL <='0';
> LBL <='0';
>
> nextstate2<=G2;
>
> When G2 =>
> inc <='1';
> Data_Bus ( 13 downto <= USB_Data ( 5 downto 0 );
> UBL <='0';
> LBL <='0';
>
> nextstate2 <=G3;
>
> When G3 =>
> inc <='0';
> Data_Bus ( 7 downto 0) <= USB_Data ( 7 downto 0 );
> UBL <='0';
> LBL <='0';
>
> nextstate2 <=G2;
> When others =>
> nextstate2 <=G0;
>
> End case;
> End Process;
>
> ----
>
> Process (USB_CLK )
> Begin
>
> If (USB_CLK 'Event And USB_CLK = '0')Then
>
> If ( sec_stop= '0') Then
>
> State2 <= nextstate2;
> State <= nextstate;
>
> Else
> State2 <= G0;
> State <= E0;
>
> End If;
>
> End If;
>
> End Process;




john
  Reply With Quote
Old 06-30-2005, 06:56 PM   #4
john
 
Posts: n/a
Default Re: Sequential Circuits power up Reset

Hi,

The problem is that USB_CLK is not present at the time of the power up.
The USBCLK activates when the user wishes it to activate. So, I was
relying on the power up reset option on the CPLD, but I think its not
working for me!

Thanks
Regards
john
john wrote:
> Hello,
>
> I am having a problem with the power up "Reset" of the 19-bit counter..
> I want it to be "0000 hex", whenever, I power up my system.
> It initializes it self to "0000hex" sometimes and sometimes it does not
> do that. I have attached the code too. Please advice!
>
> Thanks
> Regards
> John.
>
>
> Address_bus<= sec_counter;
> sec_counter<= "0000000000000000000" When Reset_A ='1' Else sec_counter
> + 1 When inc 'Event And inc= '1' And sec_stop ='0';
>
> sec_stop <= '1' When sec_counter(1='0'and sec_counter(17)='0'and
> sec_counter(16)='0' and
> sec_counter(15)='0'and sec_counter(14)='0'and sec_counter(13)='1' and
> sec_counter(12)='0'and sec_counter(11)='0'and sec_counter(10)='1' and
>
> sec_counter(9)= '0'and sec_counter(= '0'and sec_counter(7)='0' and
>
> sec_counter(6) ='0'and sec_counter(5)= '1'and sec_counter(4)='0' and
>
> sec_counter(3)= '0'and sec_counter(2)= '0'and sec_counter(1)='0' and
> sec_counter(0)= '0'
> Else
> '0';
> Process(State)
>
> Begin
>
> Case State is
>
> When E0 =>
> Reset_A <= '1';
> nextstate<= E1;
>
> When E1 =>
> Reset_A <= '0';
> nextstate<= E1;
>
> When Others =>
> Reset_A <= '1';
> nextstate<= E0;
>
>
> End Case;
> End Process;
> ----
>
> Process (State2)
> Begin
>
> Case State2 is
>
>
> When G0=>
> inc<='0';
> Data_Bus ( 13 downto <= USB_Data ( 5 downto 0 );
> UBL <='0';
> LBL <='0';
> nextstate2 <=G1;
>
> When G1 =>
> inc <='0';
> Data_Bus ( 7 downto 0) <= USB_Data ( 7 downto 0 );
> UBL <='0';
> LBL <='0';
>
> nextstate2<=G2;
>
> When G2 =>
> inc <='1';
> Data_Bus ( 13 downto <= USB_Data ( 5 downto 0 );
> UBL <='0';
> LBL <='0';
>
> nextstate2 <=G3;
>
> When G3 =>
> inc <='0';
> Data_Bus ( 7 downto 0) <= USB_Data ( 7 downto 0 );
> UBL <='0';
> LBL <='0';
>
> nextstate2 <=G2;
> When others =>
> nextstate2 <=G0;
>
> End case;
> End Process;
>
> ----
>
> Process (USB_CLK )
> Begin
>
> If (USB_CLK 'Event And USB_CLK = '0')Then
>
> If ( sec_stop= '0') Then
>
> State2 <= nextstate2;
> State <= nextstate;
>
> Else
> State2 <= G0;
> State <= E0;
>
> End If;
>
> End If;
>
> End Process;




john
  Reply With Quote
Old 06-30-2005, 08:26 PM   #5
Andy Peters
 
Posts: n/a
Default Re: Sequential Circuits power up Reset
john wrote:
> Hi,
>
> The problem is that USB_CLK is not present at the time of the power up.
> The USBCLK activates when the user wishes it to activate. So, I was
> relying on the power up reset option on the CPLD, but I think its not
> working for me!


What Jonathan said. Your code is a nightmare, and would never pass a
real code review.

-a



Andy Peters
  Reply With Quote
Old 07-01-2005, 04:22 PM   #6
john
 
Posts: n/a
Default Re: Sequential Circuits power up Reset
Hello,

Thank you very much for your reply! I tested most of the code with the
real hardware. The reason is that I use Prochip ( Atmel) software for
their chips and their simulation software sucks.
If I add additional clock to the circuitry and reset it on that clock,
will it solve the problem. Now, the CPLD is working on the USB_CLK
which is not activated when the CPLD gets powered up but a continuous
clock at the power up will reset the CPLD. Would you please advice me!

Thanks
Regards
John


john wrote:
> Hello,
>
> I am having a problem with the power up "Reset" of the 19-bit counter..
> I want it to be "0000 hex", whenever, I power up my system.
> It initializes it self to "0000hex" sometimes and sometimes it does not
> do that. I have attached the code too. Please advice!
>
> Thanks
> Regards
> John.
>
>
> Address_bus<= sec_counter;
> sec_counter<= "0000000000000000000" When Reset_A ='1' Else sec_counter
> + 1 When inc 'Event And inc= '1' And sec_stop ='0';
>
> sec_stop <= '1' When sec_counter(1='0'and sec_counter(17)='0'and
> sec_counter(16)='0' and
> sec_counter(15)='0'and sec_counter(14)='0'and sec_counter(13)='1' and
> sec_counter(12)='0'and sec_counter(11)='0'and sec_counter(10)='1' and
>
> sec_counter(9)= '0'and sec_counter(= '0'and sec_counter(7)='0' and
>
> sec_counter(6) ='0'and sec_counter(5)= '1'and sec_counter(4)='0' and
>
> sec_counter(3)= '0'and sec_counter(2)= '0'and sec_counter(1)='0' and
> sec_counter(0)= '0'
> Else
> '0';
> Process(State)
>
> Begin
>
> Case State is
>
> When E0 =>
> Reset_A <= '1';
> nextstate<= E1;
>
> When E1 =>
> Reset_A <= '0';
> nextstate<= E1;
>
> When Others =>
> Reset_A <= '1';
> nextstate<= E0;
>
>
> End Case;
> End Process;
> ----
>
> Process (State2)
> Begin
>
> Case State2 is
>
>
> When G0=>
> inc<='0';
> Data_Bus ( 13 downto <= USB_Data ( 5 downto 0 );
> UBL <='0';
> LBL <='0';
> nextstate2 <=G1;
>
> When G1 =>
> inc <='0';
> Data_Bus ( 7 downto 0) <= USB_Data ( 7 downto 0 );
> UBL <='0';
> LBL <='0';
>
> nextstate2<=G2;
>
> When G2 =>
> inc <='1';
> Data_Bus ( 13 downto <= USB_Data ( 5 downto 0 );
> UBL <='0';
> LBL <='0';
>
> nextstate2 <=G3;
>
> When G3 =>
> inc <='0';
> Data_Bus ( 7 downto 0) <= USB_Data ( 7 downto 0 );
> UBL <='0';
> LBL <='0';
>
> nextstate2 <=G2;
> When others =>
> nextstate2 <=G0;
>
> End case;
> End Process;
>
> ----
>
> Process (USB_CLK )
> Begin
>
> If (USB_CLK 'Event And USB_CLK = '0')Then
>
> If ( sec_stop= '0') Then
>
> State2 <= nextstate2;
> State <= nextstate;
>
> Else
> State2 <= G0;
> State <= E0;
>
> End If;
>
> End If;
>
> End Process;




john
  Reply With Quote
Old 07-01-2005, 04:48 PM   #7
Jonathan Bromley
 
Posts: n/a
Default Re: Sequential Circuits power up Reset
On 1 Jul 2005 08:22:32 -0700, "john" <> wrote:

>Thank you very much for your reply! I tested most of the code with the
>real hardware. The reason is that I use Prochip ( Atmel) software for
>their chips and their simulation software sucks.


No way can it suck as much as the idea of implementing stuff
without doing some functional simulation first. For small
designs you can use the free version of ModelSim that comes
with Xilinx WebPack, or you can use a free or nearly free
VHDL simulator such as Simili.

>> I am having a problem with the power up "Reset" of the 19-bit counter..


Now I read your code again, I recognise that the counter's reset
signal Reset_A is not external, but is generated by a state machine;
and this state machine has no power-up reset. So there is no
hope of your circuit ever working reliably. Add an asynchronous
reset to your state registers, and be sure that it is asserted
at startup.

You haven't answered my earlier questions: why, oh why, are
you using that disgusting coding style for state machines and
for clocked processes? People who write working VHDL usually
code their synthesisable clocked processes thus:

process (clock, reset)
begin
if reset = '1' then
registers <= reset_values;
elsif rising_edge(clock) then
registers <= next_state_value_of_registers;
end if;
end process;

You also have some nasty clock-domain-crossing issues because
an output from the state machine is used as an asynchronous reset
to the counter. Only you can decide whether that's OK in your
specific situation, but from a best-practice point of view it stinks.
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL, Verilog, SystemC, Perl, Tcl/Tk, Verification, Project Services

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, BH24 1AW, UK
Tel: +44 (0)1425 471223 mail:
Fax: +44 (0)1425 471573 Web: http://www.doulos.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.


Jonathan Bromley
  Reply With Quote
Old 07-01-2005, 07:09 PM   #8
john
 
Posts: n/a
Default Re: Sequential Circuits power up Reset
Hello,

yes, you are correct. I do not have an External Reset option or pin. I
can not have it and thats why I am trying to reset it with a state
machine running on the USB_CLK which coming from the computer and its
not there when I powerup my CPLD, there is no microprocessor or
anything else which provides my CPLD an external powerup RESET. So, I
was thinking that if I have another state machine working on a some
other continuous clock source which is present at the time of the
powerup of the CPLD can RESET the state machine working on USB_CLK.
Please advice me !
Regards
John


john wrote:
> Hello,
>
> I am having a problem with the power up "Reset" of the 19-bit counter..
> I want it to be "0000 hex", whenever, I power up my system.
> It initializes it self to "0000hex" sometimes and sometimes it does not
> do that. I have attached the code too. Please advice!
>
> Thanks
> Regards
> John.
>
>
> Address_bus<= sec_counter;
> sec_counter<= "0000000000000000000" When Reset_A ='1' Else sec_counter
> + 1 When inc 'Event And inc= '1' And sec_stop ='0';
>
> sec_stop <= '1' When sec_counter(1='0'and sec_counter(17)='0'and
> sec_counter(16)='0' and
> sec_counter(15)='0'and sec_counter(14)='0'and sec_counter(13)='1' and
> sec_counter(12)='0'and sec_counter(11)='0'and sec_counter(10)='1' and
>
> sec_counter(9)= '0'and sec_counter(= '0'and sec_counter(7)='0' and
>
> sec_counter(6) ='0'and sec_counter(5)= '1'and sec_counter(4)='0' and
>
> sec_counter(3)= '0'and sec_counter(2)= '0'and sec_counter(1)='0' and
> sec_counter(0)= '0'
> Else
> '0';
> Process(State)
>
> Begin
>
> Case State is
>
> When E0 =>
> Reset_A <= '1';
> nextstate<= E1;
>
> When E1 =>
> Reset_A <= '0';
> nextstate<= E1;
>
> When Others =>
> Reset_A <= '1';
> nextstate<= E0;
>
>
> End Case;
> End Process;
> ----
>
> Process (State2)
> Begin
>
> Case State2 is
>
>
> When G0=>
> inc<='0';
> Data_Bus ( 13 downto <= USB_Data ( 5 downto 0 );
> UBL <='0';
> LBL <='0';
> nextstate2 <=G1;
>
> When G1 =>
> inc <='0';
> Data_Bus ( 7 downto 0) <= USB_Data ( 7 downto 0 );
> UBL <='0';
> LBL <='0';
>
> nextstate2<=G2;
>
> When G2 =>
> inc <='1';
> Data_Bus ( 13 downto <= USB_Data ( 5 downto 0 );
> UBL <='0';
> LBL <='0';
>
> nextstate2 <=G3;
>
> When G3 =>
> inc <='0';
> Data_Bus ( 7 downto 0) <= USB_Data ( 7 downto 0 );
> UBL <='0';
> LBL <='0';
>
> nextstate2 <=G2;
> When others =>
> nextstate2 <=G0;
>
> End case;
> End Process;
>
> ----
>
> Process (USB_CLK )
> Begin
>
> If (USB_CLK 'Event And USB_CLK = '0')Then
>
> If ( sec_stop= '0') Then
>
> State2 <= nextstate2;
> State <= nextstate;
>
> Else
> State2 <= G0;
> State <= E0;
>
> End If;
>
> End If;
>
> End Process;




john
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
reporting power with dc_shell perseo Hardware 0 10-11-2007 09:01 AM
Judge: File-swapping tools are legal Citizen Bob DVD Video 140 11-08-2006 06:42 PM
Diagnosing Power Supplies Dave Hardenbrook A+ Certification 2 04-18-2005 01:44 AM
Re: Swollen Capacitors - I do believe! Tony A+ Certification 6 01-13-2004 04:42 AM
Power Supply Requirements Joe A+ Certification 1 12-20-2003 06:13 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46