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

Active-HDL VHDL simulation problem

Status
Not open for further replies.

ashueda

Newbie level 5
Joined
Apr 7, 2015
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
67
Hi all,
I am new to Active-HDL. I am starting to learn the tool by simulating a simple two input AND gate. The code is following,
Code:
--and.vhd
entity and_gate is  
            port (A,B:in bit;C:out bit);
end and_gate;
 
architecture and_gate_ar of and_gate is
begin               
   C<=A and B;
end and_gate_ar;
and the testbench is the following,
Code:
--and_tbench.vhd
entity tb_en is
end tb_en;

architecture tb_ar of tb_en is

component and_gate
port(
	A : in BIT;
	B : in BIT;
	C : out BIT
);
end component;

signal a_i,b_i:bit;
signal out_c:bit;

begin
stimulus: process
              begin
                  a_i <= '0'; b_i <= '0';
                  wait for 100 ns;               
                  a_i <= '0'; b_i <= '1';
                  wait for 100 ns;
                  a_i <= '1'; b_i <= '0';
                  wait for 100 ns;
                  a_i <= '1'; b_i <= '1';
                  wait for 100 ns;
                  if now = 400 ns then
                      wait;
                  end if;
end process stimulus; 

add1 : and_gate port map(A => a_i, B => b_i, C => out_c);

end tb_ar;
but when i simulate the code i get no output for the signal out_c, i.e., no output,
simulation.png

please help me where I am wrong ??
I tried the same code in modelsim it is working OK, but why not active-hdl??
I have to work in active-hdl only for my project.

please help me, thanks in advance
thanks
 

barry

Advanced Member level 5
Joined
Mar 31, 2005
Messages
4,857
Helped
1,068
Reputation
2,146
Reaction score
1,053
Trophy points
1,393
Location
California, USA
Activity points
26,501
I would suggest you expand your structure and look at the signals of the underlying elements, I.e., your actual gate.

And you don’t have “no output”, you have a zero output; there’s a difference.
 

std_match

Advanced Member level 4
Joined
Jul 9, 2010
Messages
1,083
Helped
409
Reputation
818
Reaction score
404
Trophy points
1,363
Location
Sweden
Activity points
8,276
Don't use signal type "bit". With "bit" you will lose a lot of the advantages with simulation. In this case you can't see if out_c is driven by something or not.
One explanation for your problem is that the AND gate wasn't connected during elaboration.
Replace "bit" with "std_logic" and show us the simulation result. If out_c isn't connected it will show as "U" (not assigned, the default value for std_logic).

Edit:
std_ulogic is also OK, it is better for detection of multiple drivers.
 
Last edited:

ashueda

Newbie level 5
Joined
Apr 7, 2015
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
67
Thanks for fruitful replies, I used "std_logic" as std_match suggested but still no luck,
this is the updated and.vhd with "std_logic",

LIBRARY ieee;
USE ieee.std_logic_1164.all;

entity and_gate is
port (A,B:in std_logic;C:eek:ut std_logic);
end and_gate;

architecture and_gate_ar of and_gate is
begin
C<=A and B;
end and_gate_ar;
this is the updated testbench and_tbench.vhd with "std_logic",

LIBRARY ieee;
USE ieee.std_logic_1164.all;

entity tb_en is
end tb_en;

architecture tb_ar of tb_en is

component and_gate
port(
A : in std_logic;
B : in std_logic;
C : out std_logic
);
end component;

signal a_i,b_i:std_logic;
signal out_c:std_logic;

begin
stimulus: process
begin
a_i<='0';b_i<='0';
wait for 100 ns;
a_i<='0';b_i<='1';
wait for 100 ns;
a_i<='1';b_i<='0';
wait for 100 ns;
a_i<='1';b_i<='1';
wait for 100 ns;
if now=400 ns then
wait;
end if;
end process stimulus;

add1 : and_gate port map(A=>a_i,B=>b_i,C=>out_c);

end tb_ar;
and the output:-(
simulation.png

you were right, If out_c isn't connected it will show as "U" (not assigned, the default value for std_logic).

please help me
thanks a lot
 

barry

Advanced Member level 5
Joined
Mar 31, 2005
Messages
4,857
Helped
1,068
Reputation
2,146
Reaction score
1,053
Trophy points
1,393
Location
California, USA
Activity points
26,501
What about a_i and b_i? If they’re unconnected c_out will be undefined. Show ALL your signals. There’s probably a problem with your elaboration
 

ashueda

Newbie level 5
Joined
Apr 7, 2015
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
67
Thanks sir but i am new to Active-HDL please tell me how to show ALL my signals, but please consider the following screen shot,
simulation.png

please help me
thanks
 

Akanimo

Advanced Member level 2
Joined
Aug 30, 2016
Messages
624
Helped
111
Reputation
222
Reaction score
109
Trophy points
43
Activity points
4,365
Hi,

I'd suggest that you take add1 above stimulus in your testbench and then try again.
 

std_match

Advanced Member level 4
Joined
Jul 9, 2010
Messages
1,083
Helped
409
Reputation
818
Reaction score
404
Trophy points
1,363
Location
Sweden
Activity points
8,276
The hierachy looks wrong. The and gate "add1" should be a subcircuit to "tb_en". Only the stimuli process is listed, so the and gate has not been connected.
Run it again in modelsim and look at the hierarchy.

If you remove the component declaration, you will get an error message if the and gate isn't connected. That would be an advantage here.
What you have now is a "black box" that isn't connected. Black boxes need a component declaration, but that is only causing confusion now.

If you remove the component declaration, you only have to add the keyword "entity" to the instantiation:
Code:
add1 : entity and_gate port map(A=>a_i,B=>b_i,C=>out_c);
Edit:
I think the problem is that the and gate isn't in the "work" library, and all libraries except work must be specified.
 
Last edited:

ashueda

Newbie level 5
Joined
Apr 7, 2015
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
67
thanks to all I took add1 above stimulus in my testbench as Akanimo suggested, I also removed the component declaration and used
add1 : entity and_gate port map(A=>a_i,B=>b_i,C=>out_c);
, even I made my design and library name as 'work'

but still no luck:-(
I don't know what to do??
please help me
 

ads-ee

Super Moderator
Staff member
Joined
Sep 10, 2013
Messages
7,558
Helped
1,766
Reputation
3,538
Reaction score
1,707
Trophy points
113
Location
USA
Activity points
55,718
I would delete any work or other libraries that you've compiled your code into, then recompile the design into a work library and run your simulation again.

I would suspect you have an old version of a file that is compiled and it's being used and the updated file is compiled to a different library so you don't see any elaboration errors.

This is why I always script the compile and run flow for simulation (and the first line of my script has a check for library-delete library and create a new empty one)
 

ashueda

Newbie level 5
Joined
Apr 7, 2015
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
67
Hi I tried to compile the testbench in a different library as ads-ee suggested (actually I think I could not understand fully what ads-ee said) but still no luck --- same output as before,

Pls somebody give me a short video tutorial how to do ?

Please help me
thanks and regards
 

ashueda

Newbie level 5
Joined
Apr 7, 2015
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
67
The same thing is happening with Riviera Pro also
Please help me
Thanks
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top