Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

Help me connect input to their signals in a counter VHDL code

Status
Not open for further replies.

belal elkady

Newbie level 6
Joined
Jun 4, 2011
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
EgYpT
Activity points
1,388
i made this code ( count down stopwatch ) and i wanna to connect input ( sec, min ) to their signals ( r_next , r_next2) ... but i couldn't ... can someone give some suggestions ??


library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

use IEEE.NUMERIC_STD.ALL;

entity stop_watch is
Port ( clk,res : in STD_LOGIC;
sec,min:in STD_LOGIC_VECTOR (5 downto 0);
start_stop:in std_logic;
sec_out ,min_out: out STD_LOGIC_VECTOR (5 downto 0);
finish:eek:ut std_logic);


end stop_watch;

architecture Behavioral of stop_watch is
signal r_reg:unsigned(5 downto 0);
signal r_next:unsigned(5 downto 0);
signal r_reg2:unsigned(5 downto 0);
signal r_next2:unsigned(5 downto 0);
signal mux: std_logic;
begin


process(clk,res)

begin
if (res='1')then r_reg<="000000";
elsif (clk'event and clk ='1') then r_reg<=r_next;
end if;
end process;

r_next<=r_reg when start_stop='1' else
"111100" when (r_reg="000000") else
r_reg-1;

sec_out<=STD_LOGIC_VECTOR(r_reg);
mux<='1' when r_reg="0000000"
else '0';



process (clk,mux)

begin
if mux='1' then
if (clk'event and clk='1') then
r_reg2<=r_next2;
end if ;
end if ;
end process;



r_next2<=r_reg2 when start_stop='1' else
"111100" when (r_reg2="000000") else
r_reg2 -1;
min_out<=STD_LOGIC_VECTOR (r_reg2);
finish<='1' when ( r_reg="000000" and r_reg2="000000") else
'0' ;


end Behavioral;
 

TrickyDicky

Advanced Member level 5
Joined
Jun 7, 2010
Messages
7,049
Helped
2,071
Reputation
4,159
Reaction score
2,024
Trophy points
1,393
Activity points
38,905
Re: counter (VHDL code)

according to your code you've made no attempt - so what exactly is the problm you're having?
 

TrickyDicky

Advanced Member level 5
Joined
Jun 7, 2010
Messages
7,049
Helped
2,071
Reputation
4,159
Reaction score
2,024
Trophy points
1,393
Activity points
38,905
Like I said - where is the problem you are having? It is not our job to do your work, only help when you get stuck.
 

belal elkady

Newbie level 6
Joined
Jun 4, 2011
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
EgYpT
Activity points
1,388
Like I said - where is the problem you are having? It is not our job to do your work, only help when you get stuck.
i made this code ( count down stopwatch ) and i wanna to connect input ( sec, min ) to their signals ( r_next , r_next2) ... but i couldn't ... this is the problem
 

TrickyDicky

Advanced Member level 5
Joined
Jun 7, 2010
Messages
7,049
Helped
2,071
Reputation
4,159
Reaction score
2,024
Trophy points
1,393
Activity points
38,905
why couldnt you connect it?
Show the code where you tried to connect them.
What error did you get from the compiler?
 

belal elkady

Newbie level 6
Joined
Jun 4, 2011
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
EgYpT
Activity points
1,388
. Object sec of mode IN can not be updated.
. Object min of mode IN can not be updated.
 

TrickyDicky

Advanced Member level 5
Joined
Jun 7, 2010
Messages
7,049
Helped
2,071
Reputation
4,159
Reaction score
2,024
Trophy points
1,393
Activity points
38,905
you cannot write to input ports.
Post your code.

---------- Post added at 17:18 ---------- Previous post was at 17:17 ----------

you probably want to connect to sec_out and min_out
 

belal elkady

Newbie level 6
Joined
Jun 4, 2011
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
EgYpT
Activity points
1,388
you cannot write to input ports.
Post your code.

---------- Post added at 17:18 ---------- Previous post was at 17:17 ----------

you probably want to connect to sec_out and min_out
No ... sec & min are the inputs and sec_out & min_out are the outputs they can't connect to each other ....
i need to connect them to the signals ( r-next & r_next2) .
i do this
sec<=STD_LOGIC_VECTOR (r_next);
min<=STD_LOGIC_VECTOR (r_next2);

but this shows errors as i showed before
 

TrickyDicky

Advanced Member level 5
Joined
Jun 7, 2010
Messages
7,049
Helped
2,071
Reputation
4,159
Reaction score
2,024
Trophy points
1,393
Activity points
38,905
you're trying to write to the inputs, which is illegal. dont you mean:

r_next <= unsigned(sec);
r_next2 <= unsigned(min);

?
 

belal elkady

Newbie level 6
Joined
Jun 4, 2011
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
EgYpT
Activity points
1,388
r_next <= unsigned(sec);
r_next2 <= unsigned(min);

?
i tried this before ...the Check syntax has no error but RTL schematic shows errors

ERROR:Xst:528 - Multi-source in Unit <stop_watch> on signal <min<5>>; this signal is connected to multiple drivers.
ERROR:Xst:528 - Multi-source in Unit <stop_watch> on signal <min<4>>; this signal is connected to multiple drivers.
ERROR:Xst:528 - Multi-source in Unit <stop_watch> on signal <min<3>>; this signal is connected to multiple drivers.
ERROR:Xst:528 - Multi-source in Unit <stop_watch> on signal <min<2>>; this signal is connected to multiple drivers.
ERROR:Xst:528 - Multi-source in Unit <stop_watch> on signal <min<1>>; this signal is connected to multiple drivers.
ERROR:Xst:528 - Multi-source in Unit <stop_watch> on signal <min<0>>; this signal is connected to multiple drivers.
ERROR:Xst:528 - Multi-source in Unit <stop_watch> on signal <sec<5>>; this signal is connected to multiple drivers.
ERROR:Xst:528 - Multi-source in Unit <stop_watch> on signal <sec<4>>; this signal is connected to multiple drivers.
ERROR:Xst:528 - Multi-source in Unit <stop_watch> on signal <sec<3>>; this signal is connected to multiple drivers.
ERROR:Xst:528 - Multi-source in Unit <stop_watch> on signal <sec<2>>; this signal is connected to multiple drivers.
ERROR:Xst:528 - Multi-source in Unit <stop_watch> on signal <sec<1>>; this signal is connected to multiple drivers.
ERROR:Xst:528 - Multi-source in Unit <stop_watch> on signal <sec<0>>; this signal is connected to multiple drivers.
 

TrickyDicky

Advanced Member level 5
Joined
Jun 7, 2010
Messages
7,049
Helped
2,071
Reputation
4,159
Reaction score
2,024
Trophy points
1,393
Activity points
38,905
what are min and sec connected to at the level above?
 

TrickyDicky

Advanced Member level 5
Joined
Jun 7, 2010
Messages
7,049
Helped
2,071
Reputation
4,159
Reaction score
2,024
Trophy points
1,393
Activity points
38,905
No, not inside stop_watch, in the level above.
The problem is not with this code.
 

TrickyDicky

Advanced Member level 5
Joined
Jun 7, 2010
Messages
7,049
Helped
2,071
Reputation
4,159
Reaction score
2,024
Trophy points
1,393
Activity points
38,905
If this is the top level block, Im guessing you have assigned multiple pins to the same signals.
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
47,937
Helped
14,144
Reputation
28,547
Reaction score
12,829
Trophy points
1,393
Location
Bochum, Germany
Activity points
278,141
The said error message is related to the unit stop_watch, which is the present component, but apparently a different version of it. So we can only guess about the error cause.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top