Skip to content

Commit e82ea19

Browse files
author
Sebastien Bourdeauducq
committedFeb 19, 2013
doc: tristates
1 parent 1b18194 commit e82ea19

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
 

‎doc/fhdl.rst

+20
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,33 @@ Options to ``get_port`` are:
180180

181181
Migen generates behavioural V*HDL code that should be compatible with all simulators and, if the number of ports is <= 2, most FPGA synthesizers. If a specific code is needed, the memory generator function can be overriden using the ``memory_handler`` parameter of the conversion function.
182182

183+
Tri-state I/O
184+
=============
185+
A triplet (O, OE, I) of one-way signals defining a tri-state I/O port is represented by the ``TSTriple`` object. Such objects are only containers for signals that are intended to be later connected to a tri-state I/O buffer, and cannot be used in fragments. Such objects, however, should be kept in the design as long as possible as they allow the individual one-way signals to be manipulated in a non-ambiguous way.
186+
187+
The object that can be used in a ``Fragment`` is ``Tristate``, and it behaves exactly like an instance of a tri-state I/O buffer that would be defined as follows: ::
188+
189+
Instance("Tristate",
190+
Instance.Inout("target", target),
191+
Instance.Input("o", o),
192+
Instance.Input("oe", oe),
193+
Instance.Output("i", i)
194+
)
195+
196+
Signals ``target``, ``o`` and ``i`` can have any width, while ``oe`` is 1-bit wide. The ``target`` signal should go to a port and not be used elsewhere in the design. Like modern FPGA architectures, Migen does not support internal tri-states.
197+
198+
A ``Tristate`` object can be created from a ``TSTriple`` object by calling the ``get_tristate`` method.
199+
200+
By default, Migen emits technology-independent behavioral code for a tri-state buffer. If a specific code is needed, the tristate generator function can be overriden using the ``tristate_handler`` parameter of the conversion function.
201+
183202
Fragments
184203
*********
185204
A "fragment" is a unit of logic, which is composed of:
186205

187206
* A list of combinatorial statements.
188207
* A list of synchronous statements, or a clock domain name -> synchronous statements dictionary.
189208
* A list of instances.
209+
* A list of tri-states.
190210
* A list of memories.
191211
* A list of simulation functions (see :ref:`simulating`).
192212

0 commit comments

Comments
 (0)
Please sign in to comment.