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! it's urgent! (VHDL) ncsim error:signal "p" has multiple sources

Status
Not open for further replies.

sheepherdee

Newbie level 2
Joined
Nov 24, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,300
I'm a beginner.When I complie this VHDL file of my IC design homework, I encounter with the error. I have searched many forums and know the reasons now. But I don't know how to make it right. If anyone can help me, I really appreciate. At last, thank you.

error:signal "p" has multiple sources


Code VHDL - [expand]
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
library ieee;
use ieee.std_logic_1164.all;
entity fsq is
port
(
clk : in std_logic;
u   : out std_logic
);
end fsq;
 
architecture afsq of fsq is
signal p  : std_logic_vector(3 downto 0);
signal p0 : std_logic;
signal p1 : std_logic;
signal p2 : std_logic;
signal p3 : std_logic;
 
begin
 
process(clk)
begin
if clk'event and clk='1' then
p0<=not p0;
end if;
end process;
 
process(p0)
begin
 
if p0'event and p0='0' then
p1<=not p1;
end if;
end process;
 
process(p1)
begin
if p1'event and p1='0' then
p2<=not p2;
end if;
end process;
 
process(p2)
begin
if p2'event and p2='0' then
p3<=not p3;
end if;
end process;
 
p<=p3&p2&p1&p0;
 
process(p)
begin
 
if p="1000" then
p<="0000";
end if;
 
case p is
when "0000" => u<='0';
when "0001" => u<='1';
when "0010" => u<='1';
when "0011" => u<='0';
when "0100" => u<='1';
when "0101" => u<='1';
when "0110" => u<='1';
when "0111" => u<='1';
when others => null;
end case;
 
end process;
end afsq;



THANK YOU
 
Last edited by a moderator:

barry

Advanced Member level 5
Joined
Mar 31, 2005
Messages
4,987
Helped
1,091
Reputation
2,192
Reaction score
1,075
Trophy points
1,393
Location
California, USA
Activity points
27,296
I'm a beginner.When I complie this VHDL file of my IC design homework, I encounter with the error. I have searched many forums and know the reasons now. But I don't know how to make it right. If anyone can help me, I really appreciate. At last, thank you.

error:signal "p" has multiple sources

p<=p3&p2&p1&p0;

process(p)
begin

if p="1000" then
p<="0000";
end if;


THANK YOU
Just like the error message says, you have multiple sources driving signal p. You are assigning values to p in two different places.
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
47,848
Helped
14,117
Reputation
28,491
Reaction score
12,799
Trophy points
1,393
Location
Bochum, Germany
Activity points
277,727
The problem can be easily handled by moving both assignments inside the same process.

By the way, does your homework problem ask for a ripple counter? A synchronous counter would be better.
 

sheepherdee

Newbie level 2
Joined
Nov 24, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,300
thank you !
we don't specify the type of the counter.
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
47,848
Helped
14,117
Reputation
28,491
Reaction score
12,799
Trophy points
1,393
Location
Bochum, Germany
Activity points
277,727
we don't specify the type of the counter
A ripple counter uses the output of one flip-flop as clock for the next stage. As a result, each stage gets an additional delay related to the preceeding and and the output bits toggle at different times. This causes glitches in the decoded output and limits the maximum counter frequency.

A synchronous counter uses the same clock for all flip-flops and more complex logic for the D input of each flip-flop. It's the preferred way to design a counter in programmable logic or ASIC.

It's easy to write a synchronous counter in VHDL
Code:
signal p: unsigned[2 downto 0];
...
process (clk)
if clk'event and clk='1' then
  p<=p + 1;
end if;
end process;
Another comment on the design. The state "1000" is only transient and can be omitted as well as p3. A binary counter will count from "111" to "000" without additional logic.
 
Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top