projects
/
YACASL2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
クロック周波数の定義を追加
[YACASL2.git]
/
src
/
exec.c
diff --git
a/src/exec.c
b/src/exec.c
index
d811c92
..
19be801
100644
(file)
--- a/
src/exec.c
+++ b/
src/exec.c
@@
-266,6
+266,8
@@
void exec()
WORD op, r_r1, x_r2, val;
CMDTYPE cmdtype;
char *errpr = malloc(8);
WORD op, r_r1, x_r2, val;
CMDTYPE cmdtype;
char *errpr = malloc(8);
+ clock_t clock_begin, clock_end;
+
if(tracemode) {
fprintf(stdout, "\nExecuting machine codes\n");
}
if(tracemode) {
fprintf(stdout, "\nExecuting machine codes\n");
}
@@
-278,6
+280,7
@@
void exec()
}
/* 機械語の実行 */
for (; ; ) {
}
/* 機械語の実行 */
for (; ; ) {
+ clock_begin = clock();
/* プログラムレジスタのアドレスが主記憶の範囲外の場合はエラー */
if(PR >= MEMSIZE) {
sprintf(errpr, "PR:#%04X", PR);
/* プログラムレジスタのアドレスが主記憶の範囲外の場合はエラー */
if(PR >= MEMSIZE) {
sprintf(errpr, "PR:#%04X", PR);
@@
-448,6
+451,9
@@
void exec()
default:
break;
}
default:
break;
}
+ do {
+ clock_end = clock();
+ } while(clock_end - clock_begin < CLOCKS_PER_SEC / CLOCKS);
}
execerr:
fprintf(stderr, "Execute error - %d: %s\n", cerrno, cerrmsg);
}
execerr:
fprintf(stderr, "Execute error - %d: %s\n", cerrno, cerrmsg);