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.

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;
 

Re: counter (VHDL code)

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

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.
 

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
 

why couldnt you connect it?
Show the code where you tried to connect them.
What error did you get from the compiler?
 

. Object sec of mode IN can not be updated.
. Object min of mode IN can not be updated.
 

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
 

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
 

you're trying to write to the inputs, which is illegal. dont you mean:

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

?
 

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.
 

what are min and sec connected to at the level above?
 

No, not inside stop_watch, in the level above.
The problem is not with this code.
 

If this is the top level block, Im guessing you have assigned multiple pins to the same signals.
 

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

Back
Top