minor changes, better code

This commit is contained in:
mariusmonton 2019-02-11 20:26:23 +01:00
parent 6f8cc9ded6
commit d62892e3dc
6 changed files with 10 additions and 9 deletions

View File

@ -1,5 +1,5 @@
FROM ubuntu:bionic
MAINTAINER Màrius Montón
LABEL maintainer="Màrius Montón"
ENV SYSTEMC_VERSION 2.3.3
RUN apt-get update -q && apt-get install -qy gcc-riscv64-linux-gnu

View File

@ -177,9 +177,7 @@ extension_t Instruction::check_extension() {
return C_EXTENSION;
} else if (m_instr.range(1,0) == 0b10) {
return C_EXTENSION;
} else if (m_instr.range(6,0) == 0b0101111) {
return A_EXTENSION;
} else {
} else {
return UNKNOWN_EXTENSION;
}
}

View File

@ -36,7 +36,7 @@ int main(void) {
x2 = 7;
x3 = func1(x1, &x2);
memcpy(aux, aux2, sizeof(int)*5);
memcpy(aux2, aux, sizeof(int)*5);
for(int i = 0; i < 5; i++) {
if (aux[i] != aux2[i]) {

View File

@ -28,7 +28,7 @@ int main(void) {
x2 = 7;
x3 = func1(x1, &x2);
memcpy(aux, aux2, sizeof(int)*5);
memcpy(aux2, aux, sizeof(int)*5);
for(int i = 0; i < 5; i++) {
if (aux[i] != aux2[i]) {

View File

@ -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
objcopy -Oihex timer.elf timer.hex
riscv32-unknown-elf-objdump timer.elf -d > dump

View File

@ -47,14 +47,14 @@ int main(void) {
start_time = TIMER;
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 {
timer_value = TIMER;
} while (timer_value < start_time + 2000000);
printf("Timer: %ld ns\n", timer_value);
printf("ticks: %ld\n", ticks);
printf("Timer: %d ns\n", timer_value);
printf("ticks: %d\n", ticks);
if (ticks > 2100) {
printf("Test OK!\n");