The simultaneous assignment of signals within a block is managed by
define-synchronous-system
. The next-function expressions
are functional as opposed to imperative; these expressions should not
use set!
or other mutators.
See Models for how to create (RAM) Arrays and FIFOs.
The procedure array-ref returns the contents of the array location selected by index1 index2 ....
The procedure array-set returns a copy of array with the location selected by index1 index2 ... replaced by new-value.
Returns the first item of fifo. This item will be discarded by a call to
fifo:remove-first
.
Returns fifo with its first item discarded. If fifo is already empty, an error is signalled.
Returns fifo with datum added. If fifo is already full, an error is signalled.
Returns the integer which is the bit-wise AND of the two integer arguments.
Example:
(number->string (logand #b1100 #b1010) 2) ⇒ "1000"
Returns the integer which is the bit-wise OR of the two integer arguments.
Example:
(number->string (logior #b1100 #b1010) 2) ⇒ "1110"
The arguments to
logior
must be integers. The k1 ... arguments tonumber-or
can be either integers or#f
. All the arguments tonumber-or
are evaluated. If more than one k1 ... argument is an integer, a warning using name name is issued.(number-or 'ls[2..0] (and cc-litx1 #.ls-data) (and cc-litx2 #.ls-data-x2) (and cc-litx3 #.ls-data-x3))
Issues a warning if k is not a number or negative.
number-check
returns#t
.
Returns the integer which is the bit-wise XOR of the two integer arguments.
Example:
(number->string (logxor #b1100 #b1010) 2) ⇒ "110"
Returns the integer which is the 2s-complement of the integer argument.
Example:
(number->string (lognot #b10000000) 2) ⇒ "-10000001" (number->string (lognot #b0) 2) ⇒ "-1"
Returns an integer composed of some bits from integer n0 and some from integer n1. A bit of the result is taken from n0 if the corresponding bit of integer mask is 1 and from n1 if that bit of mask is 0.
(logtest j k) == (not (zero? (logand j k))) (logtest #b0100 #b1011) ⇒ #f (logtest #b0100 #b0111) ⇒ #t
Returns
#t
if bit index of j is 1. Bit 0 is always the low order bit;(logbit? 0 data[31..24])
will be#t
only if data[31..24]'s value is odd.
Returns an integer the same as from except in the indexth bit, which is 1 if bit is
#t
and 0 if bit is#f
.Example:
(number->string (copy-bit 0 0 #t) 2) ⇒ "1" (number->string (copy-bit 2 0 #t) 2) ⇒ "100" (number->string (copy-bit 2 #b1111 #f) 2) ⇒ "1011"
Returns the integer composed of the start (inclusive) through end (exclusive) bits of n. The startth bit becomes the low order (even/odd) bit in the result. Note that the end index is one more than the high order bit index. Thus,
(bit-field data[7..0] 0 8)
and(bit-field data[31..24] 0 8)
are identity functions.This function was called
bit-extract
in SYNCH1a1.
Returns an integer the same as to except possibly in the start (inclusive) through end (exclusive) bits, which are the same as those of from. The 0-th bit of from becomes the startth bit of the result.
Example:
(number->string (copy-bit-field #b1101101010 0 0 4) 2) ⇒ "1101100000" (number->string (copy-bit-field #b1101101010 -1 0 4) 2) ⇒ "1101101111" (number->string (copy-bit-field #b110100100010000 -1 5 9) 2) ⇒ "110100111110000"
Returns an integer equivalent to
(inexact->exact (floor (*
int(expt 2
count))))
.Example:
(number->string (ash #b1 3) 2) ⇒ "1000" (number->string (ash #b1010 -1) 2) ⇒ "101"Bits shifted below the low-order bit disappear; bits shifted above the high order bit do not disappear. Remember to mask unused bits using
logand
.