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.

Can i mix VHDL and verilog in my design?

Status
Not open for further replies.

cafukarfoo

Full Member level 3
Joined
Jul 25, 2007
Messages
170
Helped
8
Reputation
16
Reaction score
5
Trophy points
1,298
Activity points
2,510
mix vhdl and verilog

Hello everyone,

Let say i have a IP block written in VHDL.

I would like to use this IP block and interface through verilog.

Is that possible? A quick example will be very helpful.

Thanks.
 

verilog vhdl mix

Its possible to do the mix design. I belive you are using Modelsim for simulation purpose.

Just go through the help doc called " Mixed simulation" You will get the idea about how to interface and other.
 

mixing verilog with vhdl

yes it is possible, if your simulator supports (most of them generally do :| )

An Example:

say u have a VHDL IP:
Code:
entity test is
port (
  a: in std_logic;
  b: in std_logic;
  c: out std_logic
);
end test;

u'll instantiate this in verilog code as:
Code:
test i_test(
  .a(),
  .b(),
  .c()
);
 
instantiate verilog ip in vhdl

sometimes the top module of individual VHDL blocks are written using verilog, because i believe its simpler to instantiate it in verilog than in vhdl, where component instantiation along with port map has to be done separately.

Also, i'm not so sure about hierarchical access to internal registers(which verilog supports) will be possible in VHDL. i'd love to proven wrong on this one.

Btw, for the example posted above, if i try to compile using modelsim (vlog) , i get a compile error because libraries are not part of verilog. How to overcome this situation?
 

instantiate vhdl block in verilog

Btw, for the example posted above, if i try to compile using modelsim (vlog) , i get a compile error because libraries are not part of verilog. How to overcome this situation?
I don't see, which library you're missing here. It's a nonsense example anyway, cause the instantiated module is connected to nothing, which is identical to omitting it completely.
 

modelsim vhdl with verilog entity

forget the above example. In vhdl code, we use these following two lines (well, atleast these two).

library ieee;
use ieee.std_logic_1164.all;

Now, when a vhdl code is instantiated in a verilog file with these two lines in it, i get an error in modelsim. thats what i meant
 

vhdl mix with block

Libraries have to be setup with ModelSim simulation, generally. But they actually are part of ModelSim, there should be particular ieee directories in your ModelSim installation.
 

mix c and verilog

here is an example code of verilog and VHDL.

library ieee;
use ieee.std_logic_1164.all;

entity OR_ent is
port( x: in std_logic;
y: in std_logic;
F: out std_logic
);
end OR_ent;

architecture OR_beh of OR_ent is
begin
F <= x or y;
end OR_beh;

================================

`include "new.vhd"

module tb_new()

reg x,y;
wire F;

OR_ent or1(.x(x),.y(y),.F(F));

initial
begin
x=1;
y=1;
#10 x=0;
y=1;
end

endmodule

When i compile the VHDL file with vcom, it compiles fine, when i compile the verilog file with vlog, i get this error.

** Error: new.vhd(2): near ";": syntax error, unexpected ';', expecting "STRING_LITERAL"

Can you tell me where i'm going wrong ?
 

mixed verilog vhdl design

One good reason for using Verilog Top-Levels is that you can then use PLI's.
 

modelsim instantiation verilog in vhdl

omara007 said:
One good reason for using Verilog Top-Levels is that you can then use PLI's.

But don't some simulators have restrictions on PLI/VHPI interfacing with mixed-language designs?
 

determine if top module is verilog or vhdl

This of course can't work in a Verilog file:
Code:
`include "new.vhd"
You have to compile both sources separately, no include is required. Having the vhdl file imported to your project is enough for ModelSim to know the component definition.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top