EmbDev.net

Forum: FPGA, VHDL & Verilog VHDL testbench


von alice n. (farramimie)


Attached files:

Rate this post
useful
not useful
hello friends,

I'm having problem while doing my testbench coding.
there is no error when check the syntax but my testbench input for clock 
and data input show the '0' waveform..it means no pulse..i edit my clock 
time but it also not work.
maybe i must do looping for the 'datain' process but i don't know.

i hope u guys will help me to solve this problem.
i'm really appreciate it.thanx..

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


Rate this post
useful
not useful
What toolchain do you use?
For how long did you let the simulation run?
Can you post a screenshot of the simulation waveform?

von alice n. (farramimie)


Attached files:

Rate this post
useful
not useful
i use GNU toolchain.
i'm also re-attach the coding that i try to do looping but the result 
still the same.
for your information i want the simulation run until 20ms it means 260 
cycle.
thanx for your helping.

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


Rate this post
useful
not useful
You are not simulating the testbench. Your top module is obviuosly a 
module called "par_encoder". At the blue bar in your screenshot there 
should be the "par_encoder_TB"...

> Attached files:
>    NEW_PARENCOD_TB.txt (2 KB, 0 downloads)
Pls attach *.vhd files, not *.txt files.
Then you will see some little magic called "syntax highlighting".

von alice n. (farramimie)



Rate this post
useful
not useful
so it means i run with wrong procedure and wrong file?
thanx sir for keep helping me.

von Duke Scarring (Guest)



Rate this post
useful
not useful
Ok. Let's try it with Modelsim:
1
~/par_testbench$ vlib work
2
bl5599@fwfi34:~/test/par_testbench$ vcom par_encoder.vhd
3
Model Technology ModelSim PE vcom 10.1 Compiler 2011.12 Dec  6 2011
4
-- Loading package STANDARD
5
-- Loading package TEXTIO
6
-- Loading package std_logic_1164
7
-- Compiling entity par_encoder
8
-- Compiling architecture Behavioral of par_encoder
9
~/par_testbench$ vcom par_encoder_TB.vhd
10
Model Technology ModelSim PE vcom 10.1 Compiler 2011.12 Dec  6 2011
11
-- Loading package STANDARD
12
-- Loading package TEXTIO
13
-- Loading package std_logic_1164
14
-- Compiling entity par_encoder_TB
15
-- Compiling architecture behavioral of par_encoder_TB
16
###### par_encoder_TB.vhd(42):             CLK1 : STD_LOGIC;
17
** Error: par_encoder_TB.vhd(42): near "CLK1": expecting BEGIN
Your testbench code didn't compile...
One edit later...
1
~/par_testbench$ vcom par_encoder_TB.vhd
2
Model Technology ModelSim PE vcom 10.1 Compiler 2011.12 Dec  6 2011
3
-- Loading package STANDARD
4
-- Loading package TEXTIO
5
-- Loading package std_logic_1164
6
-- Compiling entity par_encoder_TB
7
-- Compiling architecture behavioral of par_encoder_TB
8
###### par_encoder_TB.vhd(56):  variable I=NATURAL;
9
** Error: par_encoder_TB.vhd(56): near "=": expecting ':'
10
###### par_encoder_TB.vhd(115): END behavioral;
11
** Error: par_encoder_TB.vhd(115): VHDL Compiler exiting
One more edit...
1
~/par_testbench$ vcom par_encoder_TB.vhd
2
Model Technology ModelSim PE vcom 10.1 Compiler 2011.12 Dec  6 2011
3
-- Loading package STANDARD
4
-- Loading package TEXTIO
5
-- Loading package std_logic_1164
6
-- Compiling entity par_encoder_TB
7
-- Compiling architecture behavioral of par_encoder_TB
Looks good. Next step: fire up the simulator.
1
~/par_testbench$ vsim -gui par_encoder_TB
2
3
VSIM 1> add wave *
4
VSIM 2> run 1 ms
See results above.

Duke

von alice n. (farramimie)


Rate this post
useful
not useful
thanx both of you...
now i'm try using the modelsim software..
if have any problem i will share at this site..
thanx a lot..

von Duke Scarring (Guest)


Rate this post
useful
not useful
ISIM should also work without problem, but I'am more familiar with 
modelsim...

Duke

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


Rate this post
useful
not useful
Waht are those two clocks in your design?

Are they coming from independent sources (e.g. 10MHz and 25MHz)?
Then you will encounter major problems, because there are various VERY 
BIG design flaws in your code:
1
PARITY_EN: process (CLK1,CLK2)
2
  if (CLK1'event and CLK1='1')then 
3
     ...
4
  end if;
5
6
  if (CLK2'event and CLK2='1')then
7
     ...
8
  end if;
9
end process;
A two-clock-process, whow!
Where did you get this coding style from?
With some luck you will get it synthesized for real hardware (maybe).
But if so, you will likely encounter significant problem due to passing 
values across clock domain barriers without any synchronisation.

von imed (Guest)


Rate this post
useful
not useful
In your first wave, you let your simulation run for 1 us but your clock 
will have it's first rising edge after 37 us...
So let your simulation run longer (1 ms as did Duke under modelsim).

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.