diff --git a/docs/src/hal/components.adoc b/docs/src/hal/components.adoc index 961e0c6427e..7bfb19cc7d1 100644 --- a/docs/src/hal/components.adoc +++ b/docs/src/hal/components.adoc @@ -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 || diff --git a/src/hal/components/output_buffer.comp b/src/hal/components/output_buffer.comp new file mode 100644 index 00000000000..7ad8ce91846 --- /dev/null +++ b/src/hal/components/output_buffer.comp @@ -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; + } + } +} \ No newline at end of file