Multi-source

OP #2944702
Hello.

I am trying to make a mac component. Everything is fine, until I put 
reg_acc (my accumulator) receiving the output value.
The strange thing is that Quartus sythetize it, but Modelsim acuse a 
multi-source and responde with X in output value.
Do you guys have any ideas?

Here is the code:
1
library ieee;
2
use ieee.std_logic_1164.all;
3
use ieee.numeric_std.all;
4

5

6
ENTITY main IS
7
generic (
8
size : integer := 4;
9
port (
10
clk : in std_logic;
11
rst : in std_logic;
12
a_i : in std_logic_vector(size-1 downto 0);
13
b_i : in std_logic_vector(size-1 downto 0);
14
out_o : out std_logic_vector(2*size-1 downto 0)
15
);
16
END main;
17

18

19

20

21
ARCHITECTURE bhv OF main IS
22
COMPONENT mac
23
generic (
24
width : integer);
25
port (
26
clk : in std_logic;
27
rst : in std_logic;
28
a_i : in std_logic_vector(width-1 downto 0);
29
b_i : in std_logic_vector(width-1 downto 0);
30
acc : in std_logic_vector(2*width-1 downto 0);
31
out_sig : out std_logic_vector(2*width-1 downto 0)
32
);
33
END COMPONENT;
34

35

36
signal acc, out_sig, out_acc : std_logic_vector(2*size-1 downto 0) := (others => '0');
37

38

39
BEGIN
40

41
mac1: mac GENERIC MAP (size) PORT MAP (clk, rst, a_i, b_i, acc, out_sig);
42

43

44
reg_out : process(clk, rst)
45
begin
46
if rst = '1' then
47
out_o <= (others => '0');
48
elsif clk'event and clk = '1' then
49
out_o <= out_sig;
50
end if;
51
end process; 
52

53

54
reg_acc : process(clk, rst)  ---> HERE IS THE TROUBLE
55
begin
56
if rst = '1' then
57
acc <= (others => '0');
58
elsif clk'event and clk = '1' then
59
acc <= out_sig;
60
end if;
61
end process; 
62

63

64

65

66
END bhv;
Guest #2944737
Hi,

maybe it´s a problem that the two processes reg_out and reg_acc do the 
same, just the names of the signals the values are assigned to are 
different (out_o vs. acc). So maybe the result is ONE net with TWO Names 
and this causes Modelsim to respond with a multi-source error.

But then I don´t know why Quartus synthesizes it (are there warnings?). 
Did you take a look at the synthesized circuit?
#2944871
You assign "out_sig" to "out_o". Check, whether "out_sig" is properly 
assigned a value to (within "mac"), as there are X'es from the start of 
the simulation...
Guest #2945941
There is another Eduardo, he got this recommendation:

from: http://embdev.net/topic/279214#2943300
>3) Don't use positional assignments. Use the named assignment! Makes you
>code much more readable.

Just follow this advice, then you will see your mistake..
Startpoint:

     mac1: mac
            GENERIC MAP (width => size)
            PORT MAP (clk => clk,
                      rst => rst,
                      a_i => a_i,

  ....

Reply

A question of your own? This thread is over 13 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.