minor changes, better code
This commit is contained in:
parent
6f8cc9ded6
commit
d62892e3dc
|
@ -1,5 +1,5 @@
|
||||||
FROM ubuntu:bionic
|
FROM ubuntu:bionic
|
||||||
MAINTAINER Màrius Montón
|
LABEL maintainer="Màrius Montón"
|
||||||
ENV SYSTEMC_VERSION 2.3.3
|
ENV SYSTEMC_VERSION 2.3.3
|
||||||
|
|
||||||
RUN apt-get update -q && apt-get install -qy gcc-riscv64-linux-gnu
|
RUN apt-get update -q && apt-get install -qy gcc-riscv64-linux-gnu
|
||||||
|
|
|
@ -177,8 +177,6 @@ extension_t Instruction::check_extension() {
|
||||||
return C_EXTENSION;
|
return C_EXTENSION;
|
||||||
} else if (m_instr.range(1,0) == 0b10) {
|
} else if (m_instr.range(1,0) == 0b10) {
|
||||||
return C_EXTENSION;
|
return C_EXTENSION;
|
||||||
} else if (m_instr.range(6,0) == 0b0101111) {
|
|
||||||
return A_EXTENSION;
|
|
||||||
} else {
|
} else {
|
||||||
return UNKNOWN_EXTENSION;
|
return UNKNOWN_EXTENSION;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ int main(void) {
|
||||||
x2 = 7;
|
x2 = 7;
|
||||||
x3 = func1(x1, &x2);
|
x3 = func1(x1, &x2);
|
||||||
|
|
||||||
memcpy(aux, aux2, sizeof(int)*5);
|
memcpy(aux2, aux, sizeof(int)*5);
|
||||||
|
|
||||||
for(int i = 0; i < 5; i++) {
|
for(int i = 0; i < 5; i++) {
|
||||||
if (aux[i] != aux2[i]) {
|
if (aux[i] != aux2[i]) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ int main(void) {
|
||||||
x2 = 7;
|
x2 = 7;
|
||||||
x3 = func1(x1, &x2);
|
x3 = func1(x1, &x2);
|
||||||
|
|
||||||
memcpy(aux, aux2, sizeof(int)*5);
|
memcpy(aux2, aux, sizeof(int)*5);
|
||||||
|
|
||||||
for(int i = 0; i < 5; i++) {
|
for(int i = 0; i < 5; i++) {
|
||||||
if (aux[i] != aux2[i]) {
|
if (aux[i] != aux2[i]) {
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
riscv32-unknown-elf-gcc -Wall -I. -O0 -static -march=rv32imac -mabi=ilp32 --specs=nosys.specs timer.c timerasm.S -o timer.elf
|
riscv32-unknown-elf-gcc -Wall -I. -O0 -static -march=rv32imac -mabi=ilp32 --specs=nosys.specs timer.c timerasm.S -o timer.elf
|
||||||
objcopy -Oihex timer.elf timer.hex
|
objcopy -Oihex timer.elf timer.hex
|
||||||
riscv32-unknown-elf-objdump timer.elf -d > dump
|
riscv32-unknown-elf-objdump timer.elf -d > dump
|
||||||
|
|
|
@ -47,14 +47,14 @@ int main(void) {
|
||||||
|
|
||||||
start_time = TIMER;
|
start_time = TIMER;
|
||||||
TIMER_CMP = start_time + 10000;
|
TIMER_CMP = start_time + 10000;
|
||||||
printf("set timer to %ld ns\n", start_time + 10000);
|
printf("set timer to %d ns\n", start_time + 10000);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
timer_value = TIMER;
|
timer_value = TIMER;
|
||||||
} while (timer_value < start_time + 2000000);
|
} while (timer_value < start_time + 2000000);
|
||||||
|
|
||||||
printf("Timer: %ld ns\n", timer_value);
|
printf("Timer: %d ns\n", timer_value);
|
||||||
printf("ticks: %ld\n", ticks);
|
printf("ticks: %d\n", ticks);
|
||||||
|
|
||||||
if (ticks > 2100) {
|
if (ticks > 2100) {
|
||||||
printf("Test OK!\n");
|
printf("Test OK!\n");
|
||||||
|
|
Loading…
Reference in New Issue