-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
90 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright (c) 2024 Zero ASIC Corporation | ||
# This code is licensed under Apache License 2.0 (see LICENSE for details) | ||
|
||
# Small script that generates sample queues for inspection with a command-line tool | ||
|
||
import numpy as np | ||
from switchboard import PySbTx, PySbPacket, UmiTxRx, random_umi_packet | ||
|
||
|
||
def main(): | ||
####################################### | ||
# generate native switchboard packets # | ||
####################################### | ||
|
||
print('*** Native packets ***') | ||
print() | ||
|
||
tx = PySbTx('sb.q', fresh=True) | ||
|
||
txp = PySbPacket( | ||
destination=2, | ||
flags=1, | ||
data=np.arange(32, dtype=np.uint8) | ||
) | ||
|
||
for k in range(3): | ||
print(txp) | ||
tx.send(txp) | ||
|
||
txp.data += 1 | ||
txp.flags = 1 - txp.flags | ||
txp.destination = (txp.destination * 10) + (k + 3) | ||
|
||
print() | ||
|
||
######################## | ||
# generate UMI packets # | ||
######################## | ||
|
||
print('*** UMI packets ***') | ||
print() | ||
|
||
tx = UmiTxRx(tx_uri='umi.q', fresh=True) | ||
|
||
for k in range(3): | ||
txp = random_umi_packet() | ||
print(txp) | ||
tx.send(txp) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters