Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tapasco
tapasco
Commits
99699663
Commit
99699663
authored
Dec 13, 2017
by
Jens Korinth
Browse files
Implement wire defaults for AXI4 interfaces
parent
f26ba638
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/scala/axi/Axi4.scala
View file @
99699663
...
...
@@ -34,6 +34,12 @@ object Axi4 {
val
burst
=
UInt
(
2.
W
)
val
len
=
UInt
(
8.
W
)
val
size
=
UInt
(
3.
W
)
def
defaults
{
burst
:=
Burst
.
Type
.
incr
len
:=
0.
U
size
:=
Burst
.
Size
.
s1
}
}
object
Burst
extends
Bundle
{
...
...
@@ -47,6 +53,10 @@ object Axi4 {
class
Lock
extends
Bundle
{
val
lock
=
UInt
(
2.
W
)
def
defaults
{
lock
:=
Lock
.
Access
.
normal
}
}
object
Lock
extends
Bundle
{
...
...
@@ -57,6 +67,10 @@ object Axi4 {
class
Cache
extends
Bundle
{
val
cache
=
UInt
(
4.
W
)
def
defaults
{
cache
:=
0.
U
}
}
object
Cache
{
...
...
@@ -103,6 +117,18 @@ object Axi4 {
val
region
=
if
(
cfg
.
regionWidth
>
0
)
UInt
(
cfg
.
regionWidth
)
else
UInt
(
1.
W
)
val
user
=
if
(
cfg
.
userWidth
>
0
)
UInt
(
cfg
.
userWidth
)
else
UInt
(
1.
W
)
def
defaults
{
burst
.
defaults
lock
.
defaults
cache
.
defaults
prot
.
defaults
id
:=
0.
U
addr
:=
"hDEADBEEF"
.
U
qos
:=
0.
U
region
:=
0.
U
user
:=
0.
U
}
override
def
cloneType
=
{
new
Address
()(
cfg
).
asInstanceOf
[
this.
type
]
}
}
...
...
@@ -161,17 +187,34 @@ object Axi4 {
val
data
=
if
(
cfg
.
dataWidth
>
0
)
UInt
(
cfg
.
dataWidth
)
else
UInt
(
1.
W
)
val
last
=
Bool
()
val
user
=
if
(
cfg
.
userWidth
>
0
)
UInt
(
cfg
.
userWidth
)
else
UInt
(
1.
W
)
def
defaults
{
id
:=
0.
U
data
:=
"hDEADBEEF"
.
U
last
:=
true
.
B
user
:=
0.
U
}
}
class
Read
(
implicit
cfg
:
Configuration
)
extends
DataChannel
{
val
resp
=
UInt
(
2.
W
)
override
def
defaults
{
super
.
defaults
resp
:=
Response
.
slverr
}
override
def
cloneType
=
{
new
Read
()(
cfg
).
asInstanceOf
[
this.
type
]
}
}
class
Write
(
implicit
cfg
:
Configuration
)
extends
DataChannel
{
val
strb
=
new
Strobe
(
cfg
.
dataWidth
)
override
def
defaults
{
super
.
defaults
strb
.
defaults
}
override
def
cloneType
=
{
new
Write
()(
cfg
).
asInstanceOf
[
this.
type
]
}
}
}
...
...
@@ -181,6 +224,12 @@ object Axi4 {
val
buser
=
UInt
(
cfg
.
userWidth
)
val
bresp
=
UInt
(
2.
W
)
def
defaults
{
bid
:=
0.
U
buser
:=
0.
U
bresp
:=
Response
.
slverr
}
override
def
cloneType
=
{
new
WriteResponse
()(
cfg
).
asInstanceOf
[
this.
type
]
}
}
...
...
src/main/scala/axi/package.scala
View file @
99699663
...
...
@@ -17,6 +17,10 @@ package object axi {
class
Protection
extends
Bundle
{
val
prot
=
UInt
(
3.
W
)
def
defaults
{
prot
:=
Protection
(
Protection
.
Flag
.
NON_PRIVILEGED
,
Protection
.
Flag
.
NON_SECURE
).
U
}
}
object
Protection
{
...
...
@@ -39,6 +43,10 @@ package object axi {
class
Strobe
(
dataWidth
:
Int
)
extends
Bundle
{
val
strb
=
UInt
((
dataWidth
/
8
).
W
)
def
defaults
{
strb
:=
Strobe
(
0
until
dataWidth
/
8
:_
*
)
}
override
def
cloneType
=
{
new
Strobe
(
dataWidth
).
asInstanceOf
[
this.
type
]
}
}
...
...
Jens Korinth
@jk
mentioned in commit
17f0d672
·
Mar 05, 2018
mentioned in commit
17f0d672
mentioned in commit 17f0d67240ebf5d7e1d0be9162d272b04256c47d
Toggle commit list
Write
Preview
Supports
Markdown
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