Guest
I have a setup where there are two wires one for input to a module and
the other for output from this module. The two wires are tied together
outside of the module to form a single serial line, and then fed to a
bi-directional buffer with a direction control input. How can I model
this setup? Normally when the buffer is in the input mode the input
pin will receive what is on the other side of the buffer but if the
output is not high impedance at the same time this is happening, a
contention will happen. I would like to detect that contention. Right
now I'm using the following process to model this behavior but I
wonder if there's a better way to do it that represents the physical
connection and that does not require me to explicitly assign 'X' to
the line.
PROCESS (data_en, target, sdi, sdo)
BEGIN
IF (data_en = '1') THEN
target <= sdo;
sdi <= sdo;
ELSE
IF (sdo = 'Z') THEN
sdi <= target;
ELSE
sdi <= 'X';
END IF;
END IF;
END PROCESS;
The bidirectional buffer here is not physically represented but
implied from the process.
any help is appreciated
Thank you!
the other for output from this module. The two wires are tied together
outside of the module to form a single serial line, and then fed to a
bi-directional buffer with a direction control input. How can I model
this setup? Normally when the buffer is in the input mode the input
pin will receive what is on the other side of the buffer but if the
output is not high impedance at the same time this is happening, a
contention will happen. I would like to detect that contention. Right
now I'm using the following process to model this behavior but I
wonder if there's a better way to do it that represents the physical
connection and that does not require me to explicitly assign 'X' to
the line.
PROCESS (data_en, target, sdi, sdo)
BEGIN
IF (data_en = '1') THEN
target <= sdo;
sdi <= sdo;
ELSE
IF (sdo = 'Z') THEN
sdi <= target;
ELSE
sdi <= 'X';
END IF;
END IF;
END PROCESS;
The bidirectional buffer here is not physically represented but
implied from the process.
any help is appreciated
Thank you!