150 likes | 179 Views
Unit 7 Mixed Language Descriptions. SYLLABUS Highlights of Mixed-Language Description, How to invoke One language from the Other How to invoke One language from the Other Mixed-language Description Examples Mixed-language Description Examples Limitations of Mixed-Language Description.
E N D
Unit 7 Mixed Language Descriptions • SYLLABUS • Highlights of Mixed-Language Description, • How to invoke One language from the Other • How to invoke One language from the Other • Mixed-language Description Examples • Mixed-language Description Examples • Limitations of Mixed-Language Description.
Highlights of Mixed-Language Description • Simulator that we use with the HDL package should be able to handle mixed-language environment • Both VHDL and Verilog module files are made visible to the simulator. • In mixed-language environment both VHDL and Verilog Libraries are made visible to the simulator. • At present time, mixed language environment has many limitations. VHDL module can only invoke the entire Verilog module; and a Verilog module can only invoke a VHDL entity. We can not invoke a VHDL procedure from a Verilog module. • Mixed-Language description can combine advantages of both languages in one module.
How to Invoke a Verilog Module from VHDL Module Invoking a Verilog Module from VHDL Module -- This is the VHDL Project library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity Ver_VHD is port ( a, b : in std_logic; c: out std_logic); end Ver_VHD; architecture Ver_VHD of Ver_VHD is component V_modl port (x,y: in std_logic; z : out std_logic); -- The name of the Component V_modl should be identical to the name of the --Verilog module; also the ports should identical in name and mode --with the inputs and outputs of the Verilog module end component; ....... end Ver_VHDl //This is the Verilog module module V_modl (x, y, z); input x,y; output z; .......... Declare a VHDL component with the Same name as the Verilog Module.
Invoking VHDL entity from Verilog Module-Examples Example 1:Mixed-Language Description of a Full Adder A VHDL half-adder is written.A Verilog module uses the VHDL half adder to describe a full adder.
Example 2 Mixed-Language Description of a 9-bit Adder A VHDL description of a 3-bit Carry-lookahead adder is used to write a Verilog description of 9-bit adder
Mixed-Language Description of 3-bit Adder with zero Flag 1-bit full adder description is written in VHDL. A Verilog module uses the VHDL description to describe a 3-bit full adder with zero flag.
Mixed-Language Description of a Master-Slave D Flip-Flop A VHDL description of a D-latch is written. A Verilog module implements the VHDL description to describe a Master-Slave D Flip-Flop.
Mixed-Language Description of a 4x4 Comparator A 1-bit full adder is written in VHDL. A Verilog module implements the VHDL code to describe a 4x4 comparator.
Invoking Verilog module from VHDL Module Example: Instantiating an AND gate From VHDL Module VHDL component and2 is declared in the VHDL module. A Verilog module with the same name and2 describes and2. The Verilog description is implemented in the VHDL module.. HDL Programming Fundamentals
Mixed-Language Description of 3-bit Synchronous Counter with Clear Several VHDL components JK_FF, inv, and2, or2 have been declared in the VHDL module. Verilog is implemented to describe these components. VHDL uses the escription to describe the counter.
Mixed-Language Description of N-bit Asynchronous Counter Two Verilog modules (jkff and andgate) are implemented in a VHDL module to describe N-bit Asynchronous counter
Example Instantiating CASEX in VHDL. Table 9.2 Truth Table for 4-bit Encoder Input Output a b xxx1 1 xx10 2 x100 4 1000 8 Others 0 CaseX is a Verilog built-in function. By writing mixed language, the VHDL appears as if it has this built-in function. HDL Programming Fundamentals
Mixed-Language Description of a Low Pass RC Filter Verilog can easily handle real (floating) arithmetic operations; VHDL can easily handle File operations. By writing mixed language, we utilize the advantages of both languages. HDL Programming Fundamentals
Limitations of Mixed-Language Description • Mixed language description is limited at present time. The limitations can be summarized as follows • Not all VHDL data types are supported in mixed language description. Only bit, bit_vector, std_logic, std_ulogic, std_logic_vector, and std_ulogic_vector are supported. • VHDL Port type Buffer is not supported in many of the current simulators. • Only VHDL component construct can invoke a Verilog module. We can not invoke Verilog module from any other construct in the VHDL module. • Verilog module can only invoke a VHDL entity. It can not invoke any other construct in the VHDL module such as procedures or functions.
Summary To invoke a VHDL entity from a Verilog module, we write a module statement in Verilog. The name of the module should be identical to the name of the entity; the type of the parameters of the module should match the type of the ports of the entity. For example the module statement: HA H1 (y, cin, s0,c0); written in a Verilog module invokes a VHDL entity by the name of HA. In the Verilog module, no other module should have the same name HA. Invoking a Verilog module from VHDL module is done by declaring a component in the VHDL module with the same name as the Verilog module. The ports of the component should be the same name and match in type with the ports of the Verilog module.