Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics 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.

How to test different values of generics (generic map) in VDHL all in one testbench?

Status
Not open for further replies.

sonika111

Member level 2
Joined
Jan 11, 2011
Messages
50
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,716
How to test different values of generic (generic map) in vhdl all in one testbench -

Hi

VHDL-I was wondering how to test different values/conditions of generics (generic map) all in one testbench without making multiple testbenches with different generic conditions...


Thanks a lot
 

Re: How to test different values of generic (generic map) in vhdl all in one testben

How about a package file that has a bunch of constant declarations that you use for the generic map constants you assign.
 

Re: How to test different values of generic (generic map) in vhdl all in one testben

Your testbenches can also have generics. In modelsim, you can pass generics using -g. This only works for basic types.
Code:
vsim -gANY_NAME_HERE=5

There are other options as well. For example, within a function in a package you can convert a test case number into a more complex type. I think you can also have functions that read complex test cases from a file as well.
 

Re: How to test different values of generic (generic map) in vhdl all in one testben

You can't change generics during run time, so the only options are to either
1) run the test bench multiple times using scripting
2) instantiate the dut multiple times in a single testbench.

Usually, people use the first method to keep single cases separate and allow easier debugging
 

Re: How to test different values of generic (generic map) in vhdl all in one testben

Thanks everyone. I was wondering if anyone can share an example here passing on generics with are std_logic_vectors. Also then how to use assert statements then as it will be different for different generic parameters.
 

Re: How to test different values of generic (generic map) in vhdl all in one testben

I tried passing it but it didn't work for me. A working example will be appreciated.Thanks
 

Re: How to test different values of generic (generic map) in vhdl all in one testben

An example would be rather simple as ant generics are possible. Are you asking for code examples or scripting examples?

It may me easier if you post the code that isn't working so we can see why.
 

Re: How to test different values of generic (generic map) in vhdl all in one testben

An example would be rather simple as ant generics are possible. Are you asking for code examples or scripting examples?

It may me easier if you post the code that isn't working so we can see why.

Both would be nice.Thanks very much
 

Re: How to test different values of generic (generic map) in vhdl all in one testben

For generics


Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Library IEEE;
Use IEEE.std_logic_1164.all;
 
Entity mytest is
  Generic (
    Myslv : std_logic_vector
  )
End entity mytest;
 
Architecture test of mytest is
Begin
 
  Inst : entity work.myent
  Generic map (
    Some_generic => myslv
  )
End architecture;



Code:
Vsim mytest -gmyslv=11001100
 

Re: How to test different values of generic (generic map) in vhdl all in one testben

For generics


Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Library IEEE;
Use IEEE.std_logic_1164.all;
 
Entity mytest is
  Generic (
    Myslv : std_logic_vector
  )
End entity mytest;
 
Architecture test of mytest is
Begin
 
  Inst : entity work.myent
  Generic map (
    Some_generic => myslv
  )
End architecture;



Code:
Vsim mytest -gmyslv=11001100

Thanks very much. I did exactly the same but was not able to make it work. Anyway you very also suggesting that one can use the functions to chane the generics many time in a single test bench. Can I have an example for that? Cheers
 

Re: How to test different values of generic (generic map) in vhdl all in one testben

Thanks very much. I did exactly the same but was not able to make it work. Anyway you very also suggesting that one can use the functions to chane the generics many time in a single test bench. Can I have an example for that? Cheers

You must start the simulator once for every combination of generics, but you can supply them from the command line so the design and test bench files can stay unchanged.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top