Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/src/hal/components.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ To search in the man pages, use the UNIX tool `apropos`.
| link:../man/man9/not.9.html[not] |Inverter ||
| link:../man/man9/oneshot.9.html[oneshot] |One-shot pulse generator ||
| link:../man/man9/or2.9.html[or2] |Two-input OR gate ||
| link:../man/man9/output_buffer.9.html[output_buffer] |Feed through multiple bits when enable pin is set ||
| link:../man/man9/reset.9.html[reset] |Resets an IO signal ||
| link:../man/man9/select8.9.html[select8] |8-bit binary match detector. ||
| link:../man/man9/tof.9.html[tof] |IEC TOF timer - delay falling edge on a signal ||
Expand Down
44 changes: 44 additions & 0 deletions src/hal/components/output_buffer.comp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
component output_buffer "Feed through multiple bits when enable pin is set";
pin in bit enable "Enable input";
pin in bit in-#[32 : personality];
pin out bit out-#[32 : personality];

function _;
description """
Feed through up to 32 bit inputs to their outputs when enable set,
otherwise outputs will be zero.

┌───────────┐
output-buffer.N.in-0 ─────┤ ──[>]── ├───── output-buffer.N.out-0
│ ┌─┘ │
output-buffer.N.in-1 ─────┤ ─┼[>]── ├───── output-buffer.N.out-1
│ ├─┘ │
output-buffer.N.in-2 ─────┤ ─┼[>]── ├───── output-buffer.N.out-2
│ ├─┘ │
... ─────┤ : ├───── ...
│ : │
output-buffer.N.in-M ─────┤ ─┼[>]── ├───── output-buffer.N.out-M
│ ├─┘ │
enable ─────┤ ─┘ │
└───────────┘

The number of channels are determined by the value of 'personality'.
""";
examples """
*loadrt output_buffer count=1 personality=8* will create a 8 bit buffer.
""";
license "GPL"; // indicates GPL v2 or later
author "Hans Unzner";
option period no;
;;
FUNCTION(_) {
int i;
for(i=0; i < personality; i++) {
if(enable) {
out(i) = in(i);
}
else {
out(i) = 0;
}
}
}
Loading