EmbDev.net

Forum: FPGA, VHDL & Verilog Multi-source


von eduardo m. (edumelara)


Rate this post
useful
not useful
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;

von guest (Guest)


Rate this post
useful
not useful
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?

von eduardo m. (edumelara)


Attached files:

Rate this post
useful
not useful
I attached a screenshot of quartus ciruit.

von eduardo m. (edumelara)


Rate this post
useful
not useful
No ideas?

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
What does the testbench look like? And which signal goes X? Is there an 
assignment on the output signal?

von eduardo m. (edumelara)


Attached files:

Rate this post
useful
not useful
Take a look.

von P. K. (pek)


Rate this post
useful
not useful
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...

von bko (Guest)


Rate this post
useful
not useful
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,

  ....

von eduardo m. (edumelara)


Rate this post
useful
not useful
Thanks for the answers!

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.