Address Space
Address Space.
Classes:
| Name | Description |
|---|---|
FullError |
Full. |
Field |
Field. |
Word |
Word. |
Words |
Multiple Related Words. |
Addrspace |
Address Space. |
ReservedAddrspace |
A Reserved Address Space. |
DefaultAddrspace |
Default Address Space. |
Functions:
| Name | Description |
|---|---|
get_is_volatile |
Calc Volatile Flag based on Accesses. |
get_is_const |
Calc Is Constant Flag based on Accesses. |
name_alpha |
Convert number to a alpha digit. |
create_fill_word |
Create Fill Word. |
create_fill_field |
Create Fill Field. |
resolve_field_value |
Resolve Enumeration If necessary. |
get_mask |
Return mask for all fields of one word. |
read_on_modify |
Return |
FullError
Bases: ValueError
Full.
Field
Bases: IdentLightObject
Field.
Attributes:
| Name | Type | Description |
|---|---|---|
type_ |
BaseScalarType
|
Type. |
bus |
Access | None
|
Bus Access. |
core |
Access | None
|
Core Access. |
offset |
int | Expr
|
Rightmost Bit Position. |
is_volatile |
bool
|
Volatile. |
doc |
Doc
|
Documentation. |
attrs |
CastableAttrs
|
Attributes. |
title |
str | None
|
Alias to |
descr |
str | None
|
Alias to |
comment |
str | None
|
Alias to |
comment_or_title |
str | None
|
Return |
slice |
Slice
|
Slice with Word. |
is_const |
bool
|
Field is Constant. |
access |
str
|
Access. |
Word
Bases: IdentObject
Word.
Methods:
| Name | Description |
|---|---|
add_field |
Add field. |
lock |
Lock For Modification. |
get_field |
Get Field. |
get_default |
Return Word default value for all fields of one word. |
get_mask |
Return mask for all fields of one word. |
Attributes:
| Name | Type | Description |
|---|---|---|
fields |
Namespace
|
Fields within Word. |
offset |
int | Expr
|
Rightmost Word Position. |
width |
int
|
Width in Bits. |
depth |
int | Expr | None
|
Number of words. |
doc |
Doc
|
Documentation |
attrs |
CastableAttrs
|
Attributes. |
title |
str | None
|
Alias to |
descr |
str | None
|
Alias to |
comment |
str | None
|
Alias to |
comment_or_title |
str | None
|
Return |
slice |
Slice
|
Slice with Address Space. |
wordsize |
float
|
Word Size in Bytes. |
byteoffset |
Hex
|
Offset in Bytes, if word width is multiple of 8. |
access |
str
|
Access. |
fields
class-attribute
instance-attribute
Fields within Word.
add_field
add_field(
name,
type_,
bus=None,
core=None,
offset=None,
align=None,
is_volatile=None,
title=None,
descr=None,
comment=None,
attrs=None,
**kwargs,
)
Add field.
get_default
Return Word default value for all fields of one word.
import ucdp_addr as ua word = ua.Word(name='word', offset=0, width=32) field = word.add_field('field0', u.UintType(3, default=3), ua.access.RO) field = word.add_field('field1', u.SintType(6, default=-8), ua.access.WO, align=4) field = word.add_field('field2', u.UintType(3, default=4), ua.access.RW, align=4)
word.get_default() Hex('0x00004383') word.get_default(filter_=lambda field: field.bus.read) Hex('0x00004003') word.get_default(filter_=lambda field: field.bus.write) Hex('0x00004380') word.get_default(filter_=lambda field: field.bus.read and field.bus.write) Hex('0x00004000')
get_mask
Return mask for all fields of one word.
import ucdp_addr as ua word = ua.Word(name='word', offset=0, width=32) field = word.add_field('field0', u.UintType(3), ua.access.RO) field = word.add_field('field1', u.UintType(6), ua.access.WO, align=4) field = word.add_field('field2', u.UintType(3), ua.access.RW, align=4)
word.get_mask() Hex('0x000073F7') word.get_mask(filter_=lambda field: field.bus.read) Hex('0x00007007') word.get_mask(filter_=lambda field: field.bus.write) Hex('0x000073F0') word.get_mask(filter_=lambda field: field.bus.read and field.bus.write) Hex('0x00007000')
Words
Bases: Object
Multiple Related Words.
Methods:
| Name | Description |
|---|---|
create |
Create Helper for Set of Words. |
next |
Start a new Word. |
add_field |
Add Field to Current Word or start a new one. |
Attributes:
| Name | Type | Description |
|---|---|---|
idx |
int
|
Next Word Index. |
word |
Word
|
Current Word. |
fields |
tuple[Field, ...]
|
Fields Of All Words. |
create
classmethod
Create Helper for Set of Words.
Addrspace
Bases: AddrRange, IdentObject
Address Space.
Methods:
| Name | Description |
|---|---|
add_word |
Add Word. |
add_words |
Add Word. |
get_word |
Retrieve Word. |
lock |
Lock For Modification. |
get_word_hiername |
Get Hierarchical Word Name. |
get_field_hiername |
Get Hierarchical Field Name. |
iter |
Iterate over words and their fields. |
is_overlapping |
Determine both Address Spaces Overlap. |
get_intersect |
Get Intersection. |
join |
Join if Possible. |
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Name. |
is_sub |
bool
|
Address Decoder Just Compares |
words |
Namespace
|
Words within Address Space. |
doc |
Doc
|
Documentation |
attrs |
CastableAttrs
|
Attributes. |
add_words_naming |
NamingScheme
|
Naming Scheme for words created by |
title |
str | None
|
Alias to |
descr |
str | None
|
Alias to |
comment |
str | None
|
Alias to |
comment_or_title |
str | None
|
Return |
size_used |
Bytes
|
Number of Bytes Used. |
free_offset |
int
|
Free Offset. |
info |
str
|
Info. |
base |
str
|
Base. |
access |
str
|
Access. |
is_sub
class-attribute
instance-attribute
Address Decoder Just Compares addrwidth LSBs.
words
class-attribute
instance-attribute
Words within Address Space.
add_words_naming
class-attribute
instance-attribute
Naming Scheme for words created by add_words.
add_word
add_word(
name,
offset=None,
align=None,
byteoffset=None,
bytealign=None,
depth=None,
bus=None,
core=None,
is_volatile=None,
title=None,
descr=None,
comment=None,
**kwargs,
)
Add Word.
add_words
add_words(
name,
offset=None,
align=None,
byteoffset=None,
bytealign=None,
depth=None,
naming=None,
**kwargs,
)
Add Word.
iter
iter(
wordfilter=None,
fieldfilter=None,
fill=None,
fill_word=None,
fill_field=None,
fill_word_end=None,
fill_field_end=None,
)
Iterate over words and their fields.
is_overlapping
Determine both Address Spaces Overlap.
>>> one = Addrspace(name='one', baseaddr=0x2000, size='4kB')
>>> two = Addrspace(name='two', baseaddr=0x3000, size='4kB')
>>> three = Addrspace(name='three', baseaddr=0x2000, size='5kB')
>>> one.is_overlapping(two)
False
>>> one.is_overlapping(three)
True
>>> three.is_overlapping(one)
True
>>> three.is_overlapping(two)
True
get_intersect
Get Intersection.
>>> one = Addrspace(name='one', baseaddr=0x2000, size='4kB')
>>> two = Addrspace(name='two', baseaddr=0x3000, size='4kB')
>>> three = Addrspace(name='three', baseaddr=0x2000, size='5kB')
>>> one.get_intersect(two)
>>> one.get_intersect(three)
Addrspace(name='one', baseaddr=Hex('0x2000'), size=Bytesize('4 KB'))
>>> three.get_intersect(one)
Addrspace(name='three', baseaddr=Hex('0x2000'), size=Bytesize('4 KB'))
>>> three.get_intersect(two)
Addrspace(name='three', baseaddr=Hex('0x3000'), size=Bytesize('1 KB'))
ReservedAddrspace
DefaultAddrspace
name_alpha
Convert number to a alpha digit.
name_alpha(0) 'a' name_alpha(25) 'z' name_alpha(26) 'aa' name_alpha(27) 'ab' name_alpha(26+25) 'az' name_alpha(26+26) 'ba' name_alpha(26+26+25) 'bz' name_alpha(1000) 'alm'
get_mask
Return mask for all fields of one word.
import ucdp_addr as ua word = ua.Word(name='word', offset=0, width=32) field = word.add_field('field0', u.UintType(3), ua.access.RO) field = word.add_field('field1', u.UintType(6), ua.access.WO, align=4) field = word.add_field('field2', u.UintType(3), ua.access.RW, align=4)
get_mask(word) Hex('0x000073F7') get_mask(word, filter_=lambda field: field.bus.read) Hex('0x00007007') get_mask(word, filter_=lambda field: field.bus.write) Hex('0x000073F0') get_mask(word, filter_=lambda field: field.bus.read and field.bus.write) Hex('0x00007000')
read_on_modify
Return True if a read is needed in read-modify-write operations on word word with mask.
import ucdp_addr as ua word = ua.Word(name='word', offset=0, width=32) field = word.add_field('field0', u.UintType(3), ua.access.RO) field = word.add_field('field1', u.UintType(6), ua.access.WO, align=4) field = word.add_field('field2', u.UintType(3), ua.access.RW, align=4)
read_on_modify(word, 0x00007000) False read_on_modify(word, 0x00003000) True