Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Cortex M0 Baseline Tech
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
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
Show more breadcrumbs
SoCLabs
Cortex M0 Baseline Tech
Commits
dd8399c1
Commit
dd8399c1
authored
3 years ago
by
dwf1m12
Browse files
Options
Downloads
Patches
Plain Diff
Add binary text output file to ROM file generator
parent
0df46495
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
GLIB/mem/verilog/SROM_Ax32.v
+9
-3
9 additions, 3 deletions
GLIB/mem/verilog/SROM_Ax32.v
with
9 additions
and
3 deletions
GLIB/mem/verilog/SROM_Ax32.v
+
9
−
3
View file @
dd8399c1
...
...
@@ -10,7 +10,7 @@
//
// David Flynn (d.w.flynn@soton.ac.uk)
//
// Copyright 2021, SoC Labs (www.soclabs.org)
// Copyright 2021
-2
, SoC Labs (www.soclabs.org)
//-----------------------------------------------------------------------------
module
SROM_Ax32
...
...
@@ -25,6 +25,7 @@ module SROM_Ax32
localparam
MEMDEPTH
=
(
1
<<
(
ADDRWIDTH
)
-
1
)
-
1
;
localparam
romgenfile
=
"bootrom.v"
;
localparam
bingenfile
=
"bootrom.bintxt"
;
// Reg declarations
reg
[
7
:
0
]
rombyte0
[
0
:
MEMDEPTH
];
...
...
@@ -39,6 +40,7 @@ module SROM_Ax32
reg
[
7
:
0
]
fileimage
[((
4
<<
ADDRWIDTH
)
-
1
)
:
0
];
function
[
31
:
0
]
NoX32
;
input
[
31
:
0
]
n
;
NoX32
=
(((
^
n
)
===
1'bx
)
?
32'h0
:
n
);
endfunction
integer
fd
;
// file descriptor for file output
integer
fd2
;
// file descriptor for file 2 output
integer
i
;
reg
[
39
:
0
]
today
[
0
:
1
];
...
...
@@ -66,7 +68,8 @@ initial
if
(
romgen
!=
0
)
begin
fd
=
$
fopen
(
romgenfile
);
if
(
fd
==
0
)
begin
fd2
=
$
fopen
(
bingenfile
);
if
((
fd
==
0
)
||
(
fd2
==
0
))
begin
$
display
(
"rom32gen: Error, zero returned in response to $fopen
\n
"
);
end
else
begin
...
...
@@ -90,12 +93,15 @@ initial
$
fwrite
(
fd
,
"always @(posedge CLK) if (EN) addr_r <= ADDR;
\n
"
);
$
fwrite
(
fd
,
"always @(addr_r)"
);
$
fwrite
(
fd
,
" case(addr_r[%0d:2])
\n
"
,
ADDRWIDTH
+
1
);
for
(
i
=
0
;
i
<
4
<<
(
ADDRWIDTH
);
i
=
i
+
4
)
for
(
i
=
0
;
i
<
4
<<
(
ADDRWIDTH
);
i
=
i
+
4
)
begin
$
fwrite
(
fd
,
" %2d'h%2x : RDATA <= 32'h%8x; // 0x%04x
\n
"
,
ADDRWIDTH
,
i
>>
2
,
NoX32
(
{
fileimage
[
i
+
3
],
fileimage
[
i
+
2
],
fileimage
[
i
+
1
],
fileimage
[
i
+
0
]
}
),
i
);
$
fwrite
(
fd2
,
"%32b
\n
"
,
NoX32
(
{
fileimage
[
i
+
3
],
fileimage
[
i
+
2
],
fileimage
[
i
+
1
],
fileimage
[
i
+
0
]
}
));
end
$
fwrite
(
fd
,
" default : RDATA <=32'h0;
\n
"
);
$
fwrite
(
fd
,
" endcase
\n
"
);
$
fwrite
(
fd
,
"endmodule
\n
"
);
$
fclose
(
fd
);
$
fclose
(
fd2
);
end
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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