[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug Documentation/27496] New: The Describe-Compute example seems to be
From: |
mahlev.asaf at gmail dot com |
Subject: |
[Bug Documentation/27496] New: The Describe-Compute example seems to be wrong |
Date: |
Mon, 01 Mar 2021 20:09:19 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=27496
Bug ID: 27496
Summary: The Describe-Compute example seems to be wrong
Product: poke
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: Documentation
Assignee: unassigned at sourceware dot org
Reporter: mahlev.asaf at gmail dot com
CC: poke-devel at gnu dot org
Target Milestone: ---
In the manual, the 1.1.2 Describe-Compute section states the following:
```
For example, consider the following Poke type definition:
type Packet =
struct
{
uint<16> magic = 0xef;
uint<32> size;
byte[size] data @ 64#B;
};
This tells poke that, in order to decode a Packet, it should perform the
following procedure (a similar procedure is implied for encoding):
- Read four bytes from the IO space, mount them into an unsigned 16-bit integer
using whatever current endianness, and put it in magic. If this unsigned 16-bit
integer doesn’t equal to 0xef, then stop and emit a “data integrity” error.
- Read eight bytes, mount them into an unsigned 32-bit integer using the same
endianness, and put it in size.
- Seek the IO space to advance 16 bits.
- Do size times:
- Read one byte and mount it into an unsigned 8-bit integer.
- Put the integer in the proper place in the data array.
```
It seems that the description here isn't exactly right -
1. Surely it would read two bytes into the 16-bit integer, not four
2. And four bytes for the 32-bit integer, not eight
3. The data field is in a 64 bytes offset , but from the description it seems
that they meant it to be a 64 bit offset.
This is what I think it should be:
```
For example, consider the following Poke type definition:
type Packet =
struct
{
uint<16> magic = 0xef;
uint<32> size;
byte[size] data @ 64#b;
};
This tells poke that, in order to decode a Packet, it should perform the
following procedure (a similar procedure is implied for encoding):
- Read two bytes from the IO space, mount them into an unsigned 16-bit integer
using whatever current endianness, and put it in magic. If this unsigned 16-bit
integer doesn’t equal to 0xef, then stop and emit a “data integrity” error.
- Read four bytes, mount them into an unsigned 32-bit integer using the same
endianness, and put it in size.
- Seek the IO space to 64 bits (or 8 bytes), from the start - which means to
advance 16 bits (or 2 bytes) from the previous field.
- Do size times:
- Read one byte and mount it into an unsigned 8-bit integer.
- Put the integer in the proper place in the data array.
```
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug Documentation/27496] New: The Describe-Compute example seems to be wrong,
mahlev.asaf at gmail dot com <=