Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
SDB - Self-describing Bus
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
SDB - Self-describing Bus
Commits
76e13756
Commit
76e13756
authored
Jul 24, 2012
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc: slight reword of the endianness section
parent
3fb49318
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
sdb.tex
docs/specification/sdb.tex
+11
-11
No files found.
docs/specification/sdb.tex
View file @
76e13756
...
@@ -963,9 +963,9 @@ BusPath VendorID Product Base(Hex) Description
...
@@ -963,9 +963,9 @@ BusPath VendorID Product Base(Hex) Description
\subsection
{
Endianness Problems
}
\subsection
{
Endianness Problems
}
Please note that the host may have some issue reading the binary
Please note that the host may have some issue
s
reading the binary
dumps. According to how the bridge between the host and FPGA is
dumps. According to how the bridge between the host and FPGA is
designed you may face one of the following situation:
designed you may face one of the following situation
s
:
\begin{itemize}
\begin{itemize}
\item
The host is big-endian (data is always correct).
\item
The host is big-endian (data is always correct).
...
@@ -975,18 +975,18 @@ designed you may face one of the following situation:
...
@@ -975,18 +975,18 @@ designed you may face one of the following situation:
If the bridge is byte-oriented, i.e. each and every byte can be
If the bridge is byte-oriented, i.e. each and every byte can be
independently addressed as such, then the usual endian conversion
independently addressed as such, then the usual endian conversion
rules apply (e.g. you can
\textit
{
memcpy
}
and then access fields with
rules apply (e.g. you can
\textit
{
memcpy
}
the records to host memory
endian-aware code).
and access fields with
endian-aware code).
If the bridge i
t word-oriented, however
, the behaviour is stranger, in
If the bridge i
s word-oriented, with 32-bit words in this example
, the behaviour is stranger, in
a way. After you copied the data to host memory (whether one byte at
a way. After you copied the data to host memory (whether one byte at
a time or not), you'll find that
within each word the bytes are
a time or not), you'll find that
the bytes are swapped within each word.
swapped. This happens because when the host reads the byte at offse
t
This happens because the 32-bit word is transferred as a whole: the least significan
t
0, it requests bits 0..7, and the bridge returns the byte at offset 3,
bits remain the the least significant, but they come from offset 3 in the data structure
which corresponds to those bits
. If this is your case, you need to
and are stored at offset 0 in the little-endian host
. If this is your case, you need to
byte-swap each 32-bit word before using the structure in a
byte-swap each 32-bit word before using the structure in a
little-endian host. After such swapping, the
usual rules for
little-endian host. After such swapping, the
data fields live at the correct
multi-byte values apply
.
offsets and must be accessed as big endian
.
\subsection
{
Existing Tools
}
\subsection
{
Existing Tools
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment