UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 3278

ABEL - How to implement a bidirectional bus in ABEL

Description

The following shows how to properly code a bidirectional pin in ABEL. Note the use of the .PIN extension to specify the input signal at the pin.

解决方案


"The following code shows the correct way to code abel to

"implement a bidirectional pin.



"if sel=1 then left is in, right is out

"if sel=0 then right is in, left is out





module busses

Title 'busses'



Declarations

"inputs

clk PIN;

sel PIN;



"inouts

inout_left7..inout_left0 PIN istype 'reg';

inout_right7..inout_right0 PIN istype 'reg';





"declarations

inout_left = [inout_left7..inout_left0];

inout_right = [inout_right7..inout_right0];



"nodes

tri node istype 'com';

"in_from_left node istype 'com';

"in_from_right node istype 'com';



".pins are the inputs, without it it shows an output

in_from_left=inout_left.pin;

in_from_right=inout_right.pin;





Equations

"clks

inout_left.clk=clk;

inout_right.clk=clk;



tri=sel;

inout_left.oe=!tri;

inout_right.oe=tri;









"right to left flow

when sel==0 then inout_left:=in_from_right; else

"left to right flow

when sel==1 then inout_right:=in_from_left;





end busses







"end of abel code

Schematic Representation of busses.abl

Functional Simulation Waveforms
AR# 3278
创建日期 08/21/2007
Last Updated 07/26/2010
状态 Archive
Type 综合文章