J
john
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(18)='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(8)= '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 8) <= 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 8) <= 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;
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(18)='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(8)= '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 8) <= 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 8) <= 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;