Skip to content

Conversation

@robtaylor
Copy link
Contributor

  • Modified SiliconPlatformPort.init to not create _oe signals for output ports
  • Changed IOBuffer.elaborate to only set oe for bidirectional ports
  • Updated wire method to check if _oe is None before setting it
  • Improved oe property error message to be more specific
  • Updated tests to verify output ports don't have oe signals
  • Fixed test_wire_output to work without an oe signal
  • Removed trailing whitespace for better code quality

This fix addresses the hardware design principle that output ports should only
have _o signals, not _oe (output enable) signals. Only bidirectional ports
need _oe signals to control when they are driving vs. receiving.

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

@github-actions
Copy link

github-actions bot commented Mar 18, 2025

PR Preview Action v1.6.2
Preview removed because the pull request was closed.
2025-08-07 11:17 UTC

@github-actions
Copy link

github-actions bot commented Mar 18, 2025

Tests Skipped Failures Errors Time
92 7 💤 0 ❌ 0 🔥 1.255s ⏱️

@robtaylor robtaylor force-pushed the fix-output-port-oe branch from 352b4de to 8ce2ae9 Compare March 18, 2025 22:55
@robtaylor
Copy link
Contributor Author

reviewed ai generated parts, looks good

if hasattr(interface, 'o'):
m.d.comb += self.o.eq(interface.o)
if hasattr(interface, 'oe') and self._oe is not None:
m.d.comb += self.oe.eq(interface.oe)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the mixing of self._oe and self.oe is a bit confusing here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any suggestions? SiliconPlatformPort is public, so i think it has to be self._oe, but could be wrong!

m.d.comb += self.port.o.eq(o_inv)
m.d.comb += self.port.oe.eq(self.oe)
# Only set oe for bidirectional ports
if self.direction is io.Direction.Bidir:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this if doesn't need to be nested in the above one

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@robtaylor
Copy link
Contributor Author

@robtaylor check

@robtaylor robtaylor force-pushed the fix-output-port-oe branch from 8ce2ae9 to 09960aa Compare July 12, 2025 15:34
- Modified SiliconPlatformPort.__init__ to not create _oe signals for output ports
- Changed IOBuffer.elaborate to only set oe for bidirectional ports
- Updated wire method to check if _oe is None before setting it
- Improved oe property error message to be more specific
- Updated tests to verify output ports don't have oe signals
- Fixed test_wire_output to work without an oe signal
- Removed trailing whitespace for better code quality

This fix addresses the hardware design principle that output ports should only
have _o signals, not _oe (output enable) signals. Only bidirectional ports
need _oe signals to control when they are driving vs. receiving.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@robtaylor robtaylor force-pushed the fix-output-port-oe branch from 09960aa to c7b68da Compare July 12, 2025 15:38
@robtaylor robtaylor requested review from gatecat and lanserge July 14, 2025 10:13
@gatecat
Copy link
Contributor

gatecat commented Jul 21, 2025

I am now confused about the background of this PR. An output port with output enable is an entirely valid thing (it's possible to tristate a port without it being bidirectional, if you don't care about the input value while it's Hi-Z).

This is what Amaranth implements too: https://github.com/amaranth-lang/amaranth/blob/5689b6bc5a55fe1e634883e3fdebe8981ae3981b/amaranth/lib/io.py#L349-L350

@robtaylor
Copy link
Contributor Author

totally superceded now anyhow!

@robtaylor robtaylor closed this Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants