Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - Weird stuff in VHDL

 
Thread Tools Search this Thread
Old 04-09-2007, 07:41 PM   #1
Default Weird stuff in VHDL


HI all,

I have problem with the follwing VHDL code.

-------------------------------------------------------------------
entity signal_vs_var is
port(
clk, rst : in std_logic;
a, b, c : in std_logic_vector (3 downto 0);
x, y, z : out std_logic_vector (3 downto 0)
);
end signal_vs_var;

architecture Behavioral of signal_vs_var is

signal r, s, t : std_logic_vector (3 downto 0);
shared variable d, e, f : std_logic_vector (3 downto 0);
begin

process (clk, rst)
variable d : std_logic_vector (3 downto 0);
begin
if (rst = '0') then
for k in 0 to 3 loop
x(k) <= a(k) and b(k);
r(k) <= b(k) xor c(k);
end loop;
end if;
end process;


process (clk)
begin
if (rising_edge (clk) and rst = '1') then
r <= c;
end if;
end process;

z <= r;

end Behavioral;
-----------------------------------------------------------------

I try to simulate with ISE Simulator and the output value of z (which is similar to r) is undefined. The reason is due to two sources are trying to drive the output, z (or r) at the same time. Though I'm certain that there are indeed two sources trying to drive the outpur, z (or r), but i'm sure they are not at the same time...

some one, plz explain to me....thanks in advance...


aurora
aurora is offline   Reply With Quote
Old 04-10-2007, 11:07 AM   #2
martin.wahlstedt
Junior Member
 
Join Date: Mar 2007
Posts: 14
Default
Do not use conditions for the clock! Use only one process

process (clk, rst)
variable d : std_logic_vector (3 downto 0);
begin
if (rst = '0') then
for k in 0 to 3 loop
x(k) <= a(k) and b(k);
r(k) <= b(k) xor c(k);
end loop;
elsif rising_edge(clk) then
r <= c;
end if;
end process;


martin.wahlstedt
martin.wahlstedt is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to execute an external software from VHDL? And how to interface VHDL with JAVA? becool_nikks Software 0 03-06-2009 07:08 PM
Vending machine using VHDL arie General Help Related Topics 0 03-05-2009 05:45 AM
Help on auto conversion from Matlab to vhdl on filter design hardheart Hardware 0 12-07-2007 09:19 AM
ARRAY(n DOWNTO 0) OF STD_LOGIC_VECTOR(m DOWNTO 0) - VHDL freitass Hardware 0 11-01-2007 03:44 PM
Re: Weird problem Manuel Davila A+ Certification 0 08-06-2003 09:25 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

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