Answers Database
XABEL: how to implement a bidirectional bus in abel
Record #3278
Product Family: Software
Product Line: Data I/O
Problem Title:
XABEL: how to implement a bidirectional bus in abel
Problem Description:
Keywords: bi-directional, bidirectional, bi-dir, bidir, .pin,
abel, abl, xabel, inout, io, Data I/O, Foundation
Urgency: Standard
General 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.
Solution 1:
"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
(WEBIMAGE 2:Schematic Representation of busses.abl)
(WEBIMAGE 1:Functional Simulation Waveforms)
End of Record #3278
For the latest news, design tips, and patch information on the Xilinx design environment, check out the Xilinx Expert Journals! |