Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Platform-independent core collection
Manage
Activity
Members
Labels
Plan
Issues
15
Issue boards
Milestones
Wiki
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
Platform-independent core collection
Commits
9c60ec7d
Commit
9c60ec7d
authored
13 years ago
by
Wesley W. Terpstra
Browse files
Options
Downloads
Patches
Plain Diff
Add functions to create SDWB blocks for generic components.
parent
2f4c30fd
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/wishbone/wishbone_pkg.vhd
+115
-1
115 additions, 1 deletion
modules/wishbone/wishbone_pkg.vhd
with
115 additions
and
1 deletion
modules/wishbone/wishbone_pkg.vhd
+
115
−
1
View file @
9c60ec7d
...
@@ -67,7 +67,9 @@ package wishbone_pkg is
...
@@ -67,7 +67,9 @@ package wishbone_pkg is
constant
cc_dummy_slave_out
:
t_wishbone_slave_out
:
=
constant
cc_dummy_slave_out
:
t_wishbone_slave_out
:
=
(
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
cc_dummy_data
);
(
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
cc_dummy_data
);
-- A generally useful function.
function
f_ceil_log2
(
x
:
natural
)
return
natural
;
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- SDWB declaration
-- SDWB declaration
------------------------------------------------------------------------------
------------------------------------------------------------------------------
...
@@ -216,6 +218,10 @@ package wishbone_pkg is
...
@@ -216,6 +218,10 @@ package wishbone_pkg is
master_o
:
out
t_wishbone_master_out_array
(
g_num_slaves
-1
downto
0
));
master_o
:
out
t_wishbone_master_out_array
(
g_num_slaves
-1
downto
0
));
end
component
;
end
component
;
function
f_xwb_sdwb_crossbar_sdwb
(
g_wraparound
:
boolean
:
=
true
;
g_layout
:
t_sdwb_device_array
;
g_sdwb_addr
:
t_wishbone_address
)
return
t_sdwb_device
;
component
xwb_sdwb_crossbar
component
xwb_sdwb_crossbar
generic
(
generic
(
g_num_masters
:
integer
;
g_num_masters
:
integer
;
...
@@ -243,6 +249,10 @@ package wishbone_pkg is
...
@@ -243,6 +249,10 @@ package wishbone_pkg is
slave_o
:
out
t_wishbone_slave_out
);
slave_o
:
out
t_wishbone_slave_out
);
end
component
;
end
component
;
function
f_xwb_dpram
(
g_size
:
natural
;
g_slave1_granularity
:
t_wishbone_address_granularity
:
=
WORD
;
g_slave2_granularity
:
t_wishbone_address_granularity
:
=
WORD
)
return
t_sdwb_device
;
component
xwb_dpram
component
xwb_dpram
generic
(
generic
(
g_size
:
natural
;
g_size
:
natural
;
...
@@ -549,6 +559,14 @@ package wishbone_pkg is
...
@@ -549,6 +559,14 @@ package wishbone_pkg is
end
wishbone_pkg
;
end
wishbone_pkg
;
package
body
wishbone_pkg
is
package
body
wishbone_pkg
is
function
f_ceil_log2
(
x
:
natural
)
return
natural
is
begin
if
x
<=
1
then
return
0
;
else
return
f_ceil_log2
((
x
+
1
)
/
2
)
+
1
;
end
if
;
end
f_ceil_log2
;
-- Used to configure a device at a certain address
-- Used to configure a device at a certain address
function
f_sdwb_set_address
(
device
:
t_sdwb_device
;
address
:
t_wishbone_address
)
function
f_sdwb_set_address
(
device
:
t_sdwb_device
;
address
:
t_wishbone_address
)
return
t_sdwb_device
return
t_sdwb_device
...
@@ -561,6 +579,102 @@ package body wishbone_pkg is
...
@@ -561,6 +579,102 @@ package body wishbone_pkg is
result
.
wbd_begin
(
c_wishbone_address_width
-1
downto
0
)
:
=
unsigned
(
address
);
result
.
wbd_begin
(
c_wishbone_address_width
-1
downto
0
)
:
=
unsigned
(
address
);
result
.
wbd_end
:
=
result
.
wbd_begin
+
(
device
.
wbd_end
-
device
.
wbd_begin
);
result
.
wbd_end
:
=
result
.
wbd_begin
+
(
device
.
wbd_end
-
device
.
wbd_begin
);
-- If it has a child, remap the SDWB record address as well
if
result
.
wbd_flags
(
2
)
=
'1'
then
result
.
sdwb_child
:
=
result
.
wbd_begin
+
(
device
.
sdwb_child
-
device
.
wbd_begin
);
end
if
;
return
result
;
return
result
;
end
;
end
;
function
f_xwb_sdwb_crossbar_sdwb
(
g_wraparound
:
boolean
:
=
true
;
g_layout
:
t_sdwb_device_array
;
g_sdwb_addr
:
t_wishbone_address
)
return
t_sdwb_device
is
variable
result
:
t_sdwb_device
;
alias
c_layout
:
t_sdwb_device_array
(
g_layout
'length
-1
downto
0
)
is
g_layout
;
-- How much space does the ROM need?
constant
c_used_entries
:
natural
:
=
c_layout
'length
+
1
;
constant
c_rom_entries
:
natural
:
=
2
**
f_ceil_log2
(
c_used_entries
);
-- next power of 2
constant
c_sdwb_bytes
:
natural
:
=
c_sdwb_device_length
/
8
;
constant
c_rom_bytes
:
natural
:
=
c_rom_entries
*
c_sdwb_bytes
;
-- Step 2. Find the size of the bus
function
f_bus_end
return
unsigned
is
variable
result
:
unsigned
(
63
downto
0
);
constant
zero
:
t_wishbone_address
:
=
(
others
=>
'0'
);
begin
if
not
g_wraparound
then
result
:
=
(
others
=>
'0'
);
for
i
in
0
to
c_wishbone_address_width
-1
loop
result
(
i
)
:
=
'1'
;
end
loop
;
else
-- The ROM will be an addressed slave as well
result
:
=
(
others
=>
'0'
);
result
(
c_wishbone_address_width
-1
downto
0
)
:
=
unsigned
(
g_sdwb_addr
);
result
:
=
result
+
to_unsigned
(
c_rom_bytes
,
64
)
-
1
;
for
i
in
c_layout
'range
loop
if
c_layout
(
i
)
.
wbd_end
>
result
then
result
:
=
c_layout
(
i
)
.
wbd_end
;
end
if
;
end
loop
;
-- round result up to a power of two -1
for
i
in
62
downto
0
loop
result
(
i
)
:
=
result
(
i
)
or
result
(
i
+
1
);
end
loop
;
end
if
;
return
result
;
end
f_bus_end
;
begin
result
.
wbd_begin
:
=
x"0000000000000000"
;
result
.
sdwb_child
:
=
x"0000000000000000"
;
result
.
wbd_end
:
=
f_bus_end
;
result
.
sdwb_child
(
c_wishbone_address_width
-1
downto
0
)
:
=
unsigned
(
g_sdwb_addr
);
result
.
wbd_flags
:
=
x"05"
;
-- present, bigendian, child
result
.
wbd_width
:
=
std_logic_vector
(
to_unsigned
(
c_wishbone_address_width
/
4
-
1
,
8
));
result
.
abi_ver_major
:
=
x"01"
;
result
.
abi_ver_minor
:
=
x"00"
;
result
.
abi_class
:
=
x"00000002"
;
-- bridge device
result
.
dev_vendor
:
=
x"00000651"
;
-- GSI
result
.
dev_device
:
=
x"eef0b198"
;
result
.
dev_version
:
=
x"00000001"
;
result
.
dev_date
:
=
x"20120305"
;
result
.
description
:
=
"WB4-Bridge-GSI "
;
end
f_xwb_sdwb_crossbar_sdwb
;
function
f_xwb_dpram
(
g_size
:
natural
;
g_slave1_granularity
:
t_wishbone_address_granularity
:
=
WORD
;
g_slave2_granularity
:
t_wishbone_address_granularity
:
=
WORD
)
return
t_sdwb_device
is
variable
result
:
t_sdwb_device
;
begin
result
.
wbd_begin
:
=
x"0000000000000000"
;
result
.
sdwb_child
:
=
x"0000000000000000"
;
result
.
wbd_end
:
=
to_unsigned
(
g_size
-1
,
64
);
result
.
wbd_flags
:
=
x"01"
;
-- present, bigendian, no-child
result
.
wbd_width
:
=
std_logic_vector
(
to_unsigned
(
c_wishbone_address_width
/
4
-
1
,
8
));
result
.
abi_ver_major
:
=
x"01"
;
result
.
abi_ver_minor
:
=
x"00"
;
result
.
abi_class
:
=
x"00000002"
;
-- bridge device
result
.
dev_vendor
:
=
x"0000CE43"
;
-- CERN
result
.
dev_device
:
=
x"66cfeb52"
;
result
.
dev_version
:
=
x"00000001"
;
result
.
dev_date
:
=
x"20120305"
;
result
.
description
:
=
"WB4-BlockRAM "
;
return
result
;
end
f_xwb_dpram
;
end
wishbone_pkg
;
end
wishbone_pkg
;
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment