Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Weird stuff in VHDL

Reply
Thread Tools

Weird stuff in VHDL

 
 
aurora aurora is offline
Junior Member
Join Date: Apr 2007
Posts: 1
 
      04-09-2007
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...
 
Reply With Quote
 
 
 
 
martin.wahlstedt martin.wahlstedt is offline
Junior Member
Join Date: Mar 2007
Posts: 14
 
      04-10-2007
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;
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
VHDL-2002 vs VHDL-93 vs VHDL-87? afd VHDL 1 03-23-2007 09:33 AM
Weird stuff with char pointers, need someone to troubleshoot dtschoepe@gmail.com C Programming 7 02-23-2007 06:19 PM
Weird Stuff found using Ad-aware......... mike Computer Support 8 07-12-2005 12:03 PM
weird stuff.. dojodirectory.co.uk UK VOIP 2 07-01-2005 12:37 AM
My laptop's keyboard is typing weird stuff txlesgrrl Computer Support 1 03-07-2005 10:26 AM



Advertisments