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
16 changes: 7 additions & 9 deletions src/hal/components/and.comp → src/hal/components/and_n.comp
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
component and "Multi input AND gate";
pin in bool in##[128:personality] = 1 "input pins, up to personality-1";
component and_n "Compute the logical AND of up to 255 inputs.";
pin in bool in##[255:personality] = 1 "inputs (default is TRUE)";
pin out bool out "output pin; the AND of all inputs";

description """
The *out* pin is set to *TRUE* if all the inputs are all *TRUE*; or *FALSE* if one or more are *FALSE*.

The value for a unconnected pin is TRUE; so it is fine to leave a pin unconnected.

Set the number of pins via personality. The default value is a single *AND* with 8 inputs; so personality=8. The maximum number of inputs is 128 (hardcoded). If there are no inputs specified (personality=0); then the output value
Set the number of pins via personality. The default value is a single *AND* with 8
inputs; so personality=8. The maximum number of inputs is 255 (hardcoded).
If there are no inputs specified (personality=0); then the output value
is TRUE.
""";

function _ "Logical AND";

see_also """
*or*(9),
and2(9)
and
or2(9).
or(9), and2(9) and or2(9).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this be or_n(9) now, after the rename? Same for and(9) in or_n.comp see_also.

Suggested change
or(9), and2(9) and or2(9).
or_n(9), and2(9) and or2(9).

""";

option period no;
option default_personality 8;
option default_count 1;

license "ASLv2";
license "GPL";
author "Dirk-Willem van Gulik <dirkx(at)webweaving(punto)org";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missing the closing >? Same in or_n.comp.

Suggested change
author "Dirk-Willem van Gulik <dirkx(at)webweaving(punto)org";
author "Dirk-Willem van Gulik <dirkx(at)webweaving(punto)org>";

;;
FUNCTION(_) {
Expand Down
13 changes: 6 additions & 7 deletions src/hal/components/or.comp → src/hal/components/or_n.comp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
component or "Arbitrary input OR gate";
pin in bool in##[128:personality] = 0 "in";
component or_n "compute the logical OR of up to 255 inputs.";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Small things: "Compute" capitalised like and_n, and maybe a doc string on function _ as in and_n? git diff --check also shows some trailing whitespace in both files.

pin in bool in##[255:personality] = 0 "in (default is FALSE)";
pin out bool out "output pin; the OR of all inputs";

description """
The *out* pin is set to *TRUE* if any the inputs is *TRUE*; or *FALSE* if all are *FALSE*.

The value for a unconnected pin is FALSE; so it is fine to leave a pin unconnected.

Set the number of pins via personality. The default value is a single *OR* with 8 inputs; so personality=8. The
maximum number of inputs is 128 (hardcoded). If there are no input pins at all (personality=0); then
the output is *FALSE*.
Set the number of pins via personality. The default value is a single *OR* with 8
inputs; so personality=8. The maximum number of inputs is 155(hardcoded). If there

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think 155 should be 255, or am I missing something?

Suggested change
inputs; so personality=8. The maximum number of inputs is 155(hardcoded). If there
inputs; so personality=8. The maximum number of inputs is 255 (hardcoded). If there

are no input pins at all (personality=0); then the output is *FALSE*.
"""
;
function _;
Expand All @@ -19,9 +19,8 @@ and(9), and2(9) and or2(9).

option period no;
option default_personality 8;
option default_count 1;

license "ASLv2";
license "GPL";
author "Dirk-Willem van Gulik <dirkx(at)webweaving(punto)org";
;;
FUNCTION(_) {
Expand Down
Loading