Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cMIPS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Roberto Hexsel
cMIPS
Commits
b4baeb66
Commit
b4baeb66
authored
9 years ago
by
Roberto Hexsel
Browse files
Options
Downloads
Patches
Plain Diff
now reads from stdin, cMIPS.{h,c}
parent
23eb0ec4
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
cMIPS/include/cMIPS.h
+2
-2
2 additions, 2 deletions
cMIPS/include/cMIPS.h
cMIPS/include/cMIPS.s
+1
-1
1 addition, 1 deletion
cMIPS/include/cMIPS.s
cMIPS/include/cMIPSio.c
+11
-19
11 additions, 19 deletions
cMIPS/include/cMIPSio.c
with
14 additions
and
22 deletions
cMIPS/include/cMIPS.h
+
2
−
2
View file @
b4baeb66
#define x_INST_BASE_ADDR 0x00000000
#define x_DATA_BASE_ADDR 0x000
2
0000
#define x_DATA_BASE_ADDR 0x000
1
0000
#define x_IO_BASE_ADDR 0x0F000000
#define x_IO_MEM_SZ 0x00002000
#define x_IO_ADDR_RANGE 0x00000020
...
...
@@ -24,7 +24,7 @@
extern
void
exit
(
int
);
extern
void
print
(
int
);
extern
void
to_stdout
(
char
c
);
extern
int
from_stdin
(
char
*
);
extern
int
from_stdin
(
void
);
extern
void
writeInt
(
int
);
extern
void
writeClose
(
void
);
...
...
This diff is collapsed.
Click to expand it.
cMIPS/include/cMIPS.s
+
1
−
1
View file @
b4baeb66
...
...
@@ -3,7 +3,7 @@
.
set
x_INST_BASE_ADDR
,
0x00000000
.
set
x_INST_MEM_SZ
,
0x00004000
.
set
x_DATA_BASE_ADDR
,
0x000
2
0000
.
set
x_DATA_BASE_ADDR
,
0x000
1
0000
.
set
x_DATA_MEM_SZ
,
0x00008000
.
set
x_IO_BASE_ADDR
,
0x0F000000
...
...
This diff is collapsed.
Click to expand it.
cMIPS/include/cMIPSio.c
+
11
−
19
View file @
b4baeb66
...
...
@@ -16,11 +16,12 @@
//=======================================================================
// simulator's STD_INPUT and STD_OUTPUT
//=======================================================================
//
write an integer (hex) to
VHDL simulator's standard
out
put
void
print
(
int
n
)
{
int
*
IO
=
(
int
*
)
IO_
PR
IN
T
_ADDR
;
//
read a character from
VHDL simulator's standard
in
put
int
from_stdin
(
void
)
{
int
*
IO
=
(
void
*
)
IO_
STD
IN_ADDR
;
*
IO
=
n
;
// gets line line only after receiving a '\n' (line-feed, 0x0a)
return
(
*
IO
);
}
// write a character to VHDL simulator's standard output
...
...
@@ -31,21 +32,12 @@ void to_stdout(char c) {
*
IO
=
(
unsigned
char
)
c
;
}
// read a character from VHDL simulator's standard input
// return value = 1 if EnoOfFile, 0 otherwise
// character read is stored at address provided in argument
int
from_stdin
(
char
*
c
)
{
int
*
IO
=
(
int
*
)
IO_STDIN_ADDR
;
int
status
,
value
;
value
=
*
IO
;
status
=
*
(
IO
+
1
);
// write an integer (hex) to VHDL simulator's standard output
void
print
(
int
n
)
{
int
*
IO
=
(
int
*
)
IO_PRINT_ADDR
;
if
(
status
==
0
)
{
*
c
=
(
unsigned
char
)
value
;
*
IO
=
n
;
}
return
status
;
};
//--------------------------------------------------------------------
//=======================================================================
...
...
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