Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
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
Harbor Registry
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
Strozzi
cMIPS
Commits
d1782a3d
Commit
d1782a3d
authored
9 years ago
by
Jedian
Browse files
Options
Downloads
Patches
Plain Diff
Starting enbeautylizing
Signed-off-by:
Jedian
<
jmb15@c3sl.ufpr.br
>
parent
3f25a0d9
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
cMIPS/serial.inp
+4
-1
4 additions, 1 deletion
cMIPS/serial.inp
cMIPS/tests/jedidafu.c
+16
-14
16 additions, 14 deletions
cMIPS/tests/jedidafu.c
with
20 additions
and
15 deletions
cMIPS/serial.inp
+
4
−
1
View file @
d1782a3d
0
00000001
00000002
fffff
1
1
2
2
3
3
ffffff
4
4
5
5
6
6
...
...
This diff is collapsed.
Click to expand it.
cMIPS/tests/jedidafu.c
+
16
−
14
View file @
d1782a3d
...
@@ -101,6 +101,8 @@ int hex2int (int tam, char *hex) {
...
@@ -101,6 +101,8 @@ int hex2int (int tam, char *hex) {
if
(
hex
[
i
]
<
0
)
if
(
hex
[
i
]
<
0
)
hex
[
i
]
=
0
;
hex
[
i
]
=
0
;
ans
+=
hex
[
i
]
*
pow16
(
tam
-
(
i
+
1
));
ans
+=
hex
[
i
]
*
pow16
(
tam
-
(
i
+
1
));
if
(
ans
>
46
)
return
-
1
;
}
}
return
ans
;
return
ans
;
}
}
...
@@ -129,8 +131,8 @@ int int2hex (char *c, int i) {
...
@@ -129,8 +131,8 @@ int int2hex (char *c, int i) {
int
main
(
void
)
{
// receive a string through the UART serial interface
int
main
(
void
)
{
// receive a string through the UART serial interface
int
i
,
j
;
int
i
,
j
;
// and responds with the i-eth hex-based fibonacci sequence number
volatile
int
state
;
volatile
int
state
=
0
;
volatile
Tstatus
status
;
volatile
Tstatus
status
;
char
filona
[
145
],
c
;
char
filona
[
145
],
c
;
int
hdona
=
0
;
int
hdona
=
0
;
...
@@ -143,11 +145,11 @@ int main(void) { // receive a string through the UART serial interface
...
@@ -143,11 +145,11 @@ int main(void) { // receive a string through the UART serial interface
uart
=
(
void
*
)
IO_UART_ADDR
;
// bottom of UART address range
uart
=
(
void
*
)
IO_UART_ADDR
;
// bottom of UART address range
i
=
-
1
;
i
=
-
1
;
ioctl
(
ctrl_util
(
2
,
1
,
1
,
1
));
Ud
.
ntx
=
16
;
Ud
.
ntx
=
16
;
ioctl
(
ctrl_util
(
2
,
1
,
1
,
1
));
// Speed = 2, intRX = 1, intTX = 1, rts = 1
do
{
do
{
state
=
i
=
i
+
1
;
state
++
;
// se tirar fode (b520 vira 15)
// se tirar fode (b520 vira 15)
while
(
!
proberx
())
to_stdout
(
'-'
);
//i = 1 - i;
while
(
!
proberx
())
to_stdout
(
'-'
);
//i = 1 - i;
//to_stdout('\0');
//to_stdout('\0');
...
@@ -155,7 +157,8 @@ int main(void) { // receive a string through the UART serial interface
...
@@ -155,7 +157,8 @@ int main(void) { // receive a string through the UART serial interface
while
((
c
=
Getc
())
!=
-
1
){
while
((
c
=
Getc
())
!=
-
1
){
filona
[
tlona
]
=
c
;
filona
[
tlona
]
=
c
;
// se tirar fode (b520 vira 15)
// se tirar fode (b520 vira 15)
to_stdout
(
'*'
);
//to_stdout('*');
// cmips_delay(1);
//to_stdout('\0');
//to_stdout('\0');
// es
// es
tlona
++
;
tlona
++
;
...
@@ -168,6 +171,7 @@ int main(void) { // receive a string through the UART serial interface
...
@@ -168,6 +171,7 @@ int main(void) { // receive a string through the UART serial interface
while
(
filonx
>
0
){
while
(
filonx
>
0
){
qt
=
Strlen
(
filona
+
hdona
);
qt
=
Strlen
(
filona
+
hdona
);
valfib
=
hex2int
(
qt
,
(
filona
+
hdona
));
valfib
=
hex2int
(
qt
,
(
filona
+
hdona
));
if
(
valfib
!=
-
1
)
valfib
=
buf
[
valfib
];
valfib
=
buf
[
valfib
];
hdona
+=
qt
+
1
;
hdona
+=
qt
+
1
;
hdona
%=
145
;
hdona
%=
145
;
...
@@ -190,13 +194,11 @@ int main(void) { // receive a string through the UART serial interface
...
@@ -190,13 +194,11 @@ int main(void) { // receive a string through the UART serial interface
}
while
(
p
[
j
]
!=
0
);
}
while
(
p
[
j
]
!=
0
);
filonx
--
;
filonx
--
;
if
(
!
filonx
)
return
state
;
}
}
if
(
filonx
==
0
&&
!
fim
)
}
while
(
state
);
fim
=
1
;
else
if
(
filonx
==
0
&&
fim
)
return
state
+
i
;
}
while
(
i
<
20
);
return
(
state
+
i
)
;
return
state
;
}
}
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