aboutsummaryrefslogtreecommitdiff
path: root/VexRiscv/doc/gcdPeripheral/src/main/c/murax
diff options
context:
space:
mode:
authorFriedrich Beckmann <friedrich.beckmann@hs-augsburg.de>2022-07-25 17:55:39 +0200
committerFriedrich Beckmann <friedrich.beckmann@hs-augsburg.de>2022-07-25 17:55:39 +0200
commit3fff6023602822531efdae30bc8ebf862967f1ef (patch)
tree16028102b8d850f8ab3115d28a8539ca6bc5f51d /VexRiscv/doc/gcdPeripheral/src/main/c/murax
Initial Commit
Diffstat (limited to 'VexRiscv/doc/gcdPeripheral/src/main/c/murax')
-rw-r--r--VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/makefile134
-rw-r--r--VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/project/build.properties1
-rw-r--r--VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/crt.S98
-rw-r--r--VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/gcd.h13
-rw-r--r--VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/gpio.h15
-rw-r--r--VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/interrupt.h17
-rw-r--r--VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/linker.ld110
-rw-r--r--VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/main.c62
-rw-r--r--VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/main.h78
-rw-r--r--VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/murax.h20
-rw-r--r--VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/prescaler.h16
-rw-r--r--VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/timer.h20
-rw-r--r--VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/uart.h42
13 files changed, 626 insertions, 0 deletions
diff --git a/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/makefile b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/makefile
new file mode 100644
index 0000000..0f4abd8
--- /dev/null
+++ b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/makefile
@@ -0,0 +1,134 @@
+PROJ_NAME=gcd_world
+DEBUG=no
+BENCH=no
+MULDIV=no
+
+SRCS = $(wildcard src/*.c) \
+ $(wildcard src/*.cpp) \
+ $(wildcard src/*.S)
+
+OBJDIR = build
+
+INC =
+LIBS =
+LIBSINC = -L$(OBJDIR)
+LDSCRIPT = ./src/linker.ld
+
+#include ../../../resources/gcc.mk
+# Set it to yes if you are using the sifive precompiled GCC pack
+SIFIVE_GCC_PACK ?= no
+
+ifeq ($(SIFIVE_GCC_PACK),yes)
+ RISCV_NAME ?= riscv64-unknown-elf
+ RISCV_PATH ?= /home/sallar/tools/riscv-64-newlib-dist/
+else
+ RISCV_NAME ?= riscv32-unknown-elf
+ ifeq ($(MULDIV),yes)
+ RISCV_PATH ?= /home/sallar/tools/riscv-32-imac-ilp32-newlib-dist/
+ else
+ RISCV_PATH ?= /home/sallar/tools/rv32i-ilp32-dist/
+ endif
+endif
+
+MABI=ilp32
+MARCH := rv32i
+ifeq ($(MULDIV),yes)
+ MARCH := $(MARCH)m
+endif
+ifeq ($(COMPRESSED),yes)
+ MARCH := $(MARCH)ac
+endif
+
+CFLAGS += -march=$(MARCH) -mabi=$(MABI) -DNDEBUG
+LDFLAGS += -march=$(MARCH) -mabi=$(MABI)
+
+
+
+#include ../../../resources/subproject.mk
+
+
+ifeq ($(DEBUG),yes)
+ CFLAGS += -g3 -O0
+endif
+
+ifeq ($(DEBUG),no)
+ CFLAGS += -g -Os
+endif
+
+ifeq ($(BENCH),yes)
+ CFLAGS += -fno-inline
+endif
+
+ifeq ($(SIFIVE_GCC_PACK),yes)
+ RISCV_CLIB=$(RISCV_PATH)/$(RISCV_NAME)/lib/$(MARCH)/$(MABI)/
+else
+ RISCV_CLIB=$(RISCV_PATH)/$(RISCV_NAME)/lib/
+endif
+
+
+
+
+
+RISCV_OBJCOPY = $(RISCV_PATH)/bin/$(RISCV_NAME)-objcopy
+RISCV_OBJDUMP = $(RISCV_PATH)/bin/$(RISCV_NAME)-objdump
+RISCV_CC=$(RISCV_PATH)/bin/$(RISCV_NAME)-gcc
+
+CFLAGS += -MD -fstrict-volatile-bitfields -fno-strict-aliasing
+LDFLAGS += -nostdlib -lgcc -mcmodel=medany -nostartfiles -ffreestanding -Wl,-Bstatic,-T,$(LDSCRIPT),-Map,$(OBJDIR)/$(PROJ_NAME).map,--print-memory-usage
+#LDFLAGS += -lgcc -lc -lg -nostdlib -lgcc -msave-restore --strip-debug,
+
+OBJS := $(SRCS)
+OBJS := $(OBJS:.c=.o)
+OBJS := $(OBJS:.cpp=.o)
+OBJS := $(OBJS:.S=.o)
+OBJS := $(OBJS:..=miaou)
+OBJS := $(addprefix $(OBJDIR)/,$(OBJS))
+
+
+all: $(OBJDIR)/$(PROJ_NAME).elf $(OBJDIR)/$(PROJ_NAME).hex $(OBJDIR)/$(PROJ_NAME).asm $(OBJDIR)/$(PROJ_NAME).v
+
+$(OBJDIR)/%.elf: $(OBJS) | $(OBJDIR)
+ $(RISCV_CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBSINC) $(LIBS)
+
+%.hex: %.elf
+ $(RISCV_OBJCOPY) -O ihex $^ $@
+
+%.bin: %.elf
+ $(RISCV_OBJCOPY) -O binary $^ $@
+
+%.v: %.elf
+ $(RISCV_OBJCOPY) -O verilog $^ $@
+
+%.asm: %.elf
+ $(RISCV_OBJDUMP) -S -d $^ > $@
+
+$(OBJDIR)/%.o: %.c
+ mkdir -p $(dir $@)
+ $(RISCV_CC) -c $(CFLAGS) $(INC) -o $@ $^
+ $(RISCV_CC) -S $(CFLAGS) $(INC) -o $@.disasm $^
+
+$(OBJDIR)/%.o: %.cpp
+ mkdir -p $(dir $@)
+ $(RISCV_CC) -c $(CFLAGS) $(INC) -o $@ $^
+
+$(OBJDIR)/%.o: %.S
+ mkdir -p $(dir $@)
+ $(RISCV_CC) -c $(CFLAGS) -o $@ $^ -D__ASSEMBLY__=1
+
+$(OBJDIR):
+ mkdir -p $@
+
+.PHONY: clean
+clean:
+ rm -rf $(OBJDIR)/src
+ rm -f $(OBJDIR)/$(PROJ_NAME).elf
+ rm -f $(OBJDIR)/$(PROJ_NAME).hex
+ rm -f $(OBJDIR)/$(PROJ_NAME).map
+ rm -f $(OBJDIR)/$(PROJ_NAME).v
+ rm -f $(OBJDIR)/$(PROJ_NAME).asm
+ find $(OBJDIR) -type f -name '*.o' -print0 | xargs -0 -r rm
+ find $(OBJDIR) -type f -name '*.d' -print0 | xargs -0 -r rm
+
+clean-all : clean
+
+.SECONDARY: $(OBJS)
diff --git a/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/project/build.properties b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/project/build.properties
new file mode 100644
index 0000000..dbae93b
--- /dev/null
+++ b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/project/build.properties
@@ -0,0 +1 @@
+sbt.version=1.4.9
diff --git a/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/crt.S b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/crt.S
new file mode 100644
index 0000000..62d67b9
--- /dev/null
+++ b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/crt.S
@@ -0,0 +1,98 @@
+.global crtStart
+.global main
+.global irqCallback
+
+ .section .start_jump,"ax",@progbits
+crtStart:
+ //long jump to allow crtInit to be anywhere
+ //do it always in 12 bytes
+ lui x2, %hi(crtInit)
+ addi x2, x2, %lo(crtInit)
+ jalr x1,x2
+ nop
+
+.section .text
+
+.global trap_entry
+.align 5
+trap_entry:
+ sw x1, - 1*4(sp)
+ sw x5, - 2*4(sp)
+ sw x6, - 3*4(sp)
+ sw x7, - 4*4(sp)
+ sw x10, - 5*4(sp)
+ sw x11, - 6*4(sp)
+ sw x12, - 7*4(sp)
+ sw x13, - 8*4(sp)
+ sw x14, - 9*4(sp)
+ sw x15, -10*4(sp)
+ sw x16, -11*4(sp)
+ sw x17, -12*4(sp)
+ sw x28, -13*4(sp)
+ sw x29, -14*4(sp)
+ sw x30, -15*4(sp)
+ sw x31, -16*4(sp)
+ addi sp,sp,-16*4
+ call irqCallback
+ lw x1 , 15*4(sp)
+ lw x5, 14*4(sp)
+ lw x6, 13*4(sp)
+ lw x7, 12*4(sp)
+ lw x10, 11*4(sp)
+ lw x11, 10*4(sp)
+ lw x12, 9*4(sp)
+ lw x13, 8*4(sp)
+ lw x14, 7*4(sp)
+ lw x15, 6*4(sp)
+ lw x16, 5*4(sp)
+ lw x17, 4*4(sp)
+ lw x28, 3*4(sp)
+ lw x29, 2*4(sp)
+ lw x30, 1*4(sp)
+ lw x31, 0*4(sp)
+ addi sp,sp,16*4
+ mret
+ .text
+
+
+crtInit:
+ .option push
+ .option norelax
+ la gp, __global_pointer$
+ .option pop
+ la sp, _stack_start
+
+bss_init:
+ la a0, _bss_start
+ la a1, _bss_end
+bss_loop:
+ beq a0,a1,bss_done
+ sw zero,0(a0)
+ add a0,a0,4
+ j bss_loop
+bss_done:
+
+ctors_init:
+ la a0, _ctors_start
+ addi sp,sp,-4
+ctors_loop:
+ la a1, _ctors_end
+ beq a0,a1,ctors_done
+ lw a3,0(a0)
+ add a0,a0,4
+ sw a0,0(sp)
+ jalr a3
+ lw a0,0(sp)
+ j ctors_loop
+ctors_done:
+ addi sp,sp,4
+
+
+ li a0, 0x880 //880 enable timer + external interrupts
+ csrw mie,a0
+ li a0, 0x1808 //1808 enable interrupts
+ csrw mstatus,a0
+
+ call main
+infinitLoop:
+ j infinitLoop
diff --git a/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/gcd.h b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/gcd.h
new file mode 100644
index 0000000..1d3ccb7
--- /dev/null
+++ b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/gcd.h
@@ -0,0 +1,13 @@
+#ifndef GCD_H_
+#define GCD_H_
+
+typedef struct
+{
+ volatile uint32_t A;
+ volatile uint32_t B;
+ volatile uint32_t RES;
+ volatile uint32_t READY;
+ volatile uint32_t VALID;
+} Gcd_Reg;
+
+#endif /* GCD_H_ */
diff --git a/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/gpio.h b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/gpio.h
new file mode 100644
index 0000000..34348fe
--- /dev/null
+++ b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/gpio.h
@@ -0,0 +1,15 @@
+#ifndef GPIO_H_
+#define GPIO_H_
+
+
+typedef struct
+{
+ volatile uint32_t INPUT;
+ volatile uint32_t OUTPUT;
+ volatile uint32_t OUTPUT_ENABLE;
+} Gpio_Reg;
+
+
+#endif /* GPIO_H_ */
+
+
diff --git a/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/interrupt.h b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/interrupt.h
new file mode 100644
index 0000000..23b7d27
--- /dev/null
+++ b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/interrupt.h
@@ -0,0 +1,17 @@
+#ifndef INTERRUPTCTRL_H_
+#define INTERRUPTCTRL_H_
+
+#include <stdint.h>
+
+typedef struct
+{
+ volatile uint32_t PENDINGS;
+ volatile uint32_t MASKS;
+} InterruptCtrl_Reg;
+
+static void interruptCtrl_init(InterruptCtrl_Reg* reg){
+ reg->MASKS = 0;
+ reg->PENDINGS = 0xFFFFFFFF;
+}
+
+#endif /* INTERRUPTCTRL_H_ */
diff --git a/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/linker.ld b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/linker.ld
new file mode 100644
index 0000000..57bc2f7
--- /dev/null
+++ b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/linker.ld
@@ -0,0 +1,110 @@
+/*
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or
+distribute this software, either in source code form or as a compiled
+binary, for any purpose, commercial or non-commercial, and by any
+means.
+*/
+OUTPUT_FORMAT("elf32-littleriscv", "elf32-littleriscv", "elf32-littleriscv")
+OUTPUT_ARCH(riscv)
+ENTRY(crtStart)
+
+MEMORY {
+ RAM (rwx): ORIGIN = 0x80000000, LENGTH = 2k
+}
+
+_stack_size = DEFINED(_stack_size) ? _stack_size : 256;
+_heap_size = DEFINED(_heap_size) ? _heap_size : 0;
+
+SECTIONS {
+
+ ._vector ORIGIN(RAM): {
+ *crt.o(.start_jump);
+ *crt.o(.text);
+ } > RAM
+
+ ._user_heap (NOLOAD):
+ {
+ . = ALIGN(8);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ PROVIDE ( _heap_start = .);
+ . = . + _heap_size;
+ . = ALIGN(8);
+ PROVIDE ( _heap_end = .);
+ } > RAM
+
+._stack (NOLOAD):
+ {
+ . = ALIGN(16);
+ PROVIDE (_stack_end = .);
+ . = . + _stack_size;
+ . = ALIGN(16);
+ PROVIDE (_stack_start = .);
+ } > RAM
+
+ .data :
+ {
+ *(.rdata)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.r.*)
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ . = ALIGN(8);
+ PROVIDE( __global_pointer$ = . + 0x800 );
+ *(.sdata .sdata.*)
+ *(.gnu.linkonce.s.*)
+ . = ALIGN(8);
+ *(.srodata.cst16)
+ *(.srodata.cst8)
+ *(.srodata.cst4)
+ *(.srodata.cst2)
+ *(.srodata .srodata.*)
+ } > RAM
+
+ .bss (NOLOAD) : {
+ . = ALIGN(4);
+ /* This is used by the startup in order to initialize the .bss secion */
+ _bss_start = .;
+ *(.sbss*)
+ *(.gnu.linkonce.sb.*)
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ . = ALIGN(4);
+ _bss_end = .;
+ } > RAM
+
+
+ .rodata :
+ {
+ *(.rdata)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.r.*)
+ } > RAM
+
+ .noinit (NOLOAD) : {
+ . = ALIGN(4);
+ *(.noinit .noinit.*)
+ . = ALIGN(4);
+ } > RAM
+
+ .memory : {
+ *(.text);
+ end = .;
+ } > RAM
+
+ .ctors :
+ {
+ . = ALIGN(4);
+ _ctors_start = .;
+ KEEP(*(.init_array*))
+ KEEP (*(SORT(.ctors.*)))
+ KEEP (*(.ctors))
+ . = ALIGN(4);
+ _ctors_end = .;
+ PROVIDE ( END_OF_SW_IMAGE = . );
+ } > RAM
+
+}
diff --git a/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/main.c b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/main.c
new file mode 100644
index 0000000..fccbcc2
--- /dev/null
+++ b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/main.c
@@ -0,0 +1,62 @@
+//#include "stddefs.h"
+#include <stdint.h>
+
+#include "murax.h"
+
+#include "main.h"
+
+#define DEBUG 0
+
+uint32_t gcd(uint32_t a, uint32_t b){
+ GCD->A = a;
+ GCD->B = b;
+ GCD->VALID = 0x00000001;
+ uint32_t rdyFlag = 0;
+ do{
+ rdyFlag = GCD->READY;
+ }while(!rdyFlag);
+ return GCD->RES;
+}
+
+void calcPrintGCD(uint32_t a, uint32_t b){
+ uint32_t myGCD = 0;
+ char buf[5] = { 0x00 };
+ char aBuf[11] = { 0x00 };
+ char bBuf[11] = { 0x00 };
+ itoa(a, aBuf, 10);
+ itoa(b, bBuf, 10);
+ print("gcd(");print(aBuf);print(",");print(bBuf);println("):");
+ myGCD = gcd(a,b);
+ itoa(myGCD, buf, 10);
+ println(buf);
+}
+
+void main() {
+ GPIO_A->OUTPUT_ENABLE = 0x0000000F;
+ GPIO_A->OUTPUT = 0x00000001;
+ println("hello gcd world");
+ const int nleds = 4;
+ const int nloops = 2000000;
+
+ GCD->VALID = 0x00000000;
+ while(GCD->READY);
+
+ calcPrintGCD(1, 123913);
+ calcPrintGCD(461952, 116298);
+ calcPrintGCD(461952, 116298);
+ calcPrintGCD(461952, 116298);
+
+ while(1){
+ for(unsigned int i=0;i<nleds-1;i++){
+ GPIO_A->OUTPUT = 1<<i;
+ delay(nloops);
+ }
+ for(unsigned int i=0;i<nleds-1;i++){
+ GPIO_A->OUTPUT = (1<<(nleds-1))>>i;
+ delay(nloops);
+ }
+ }
+}
+
+void irqCallback(){
+}
diff --git a/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/main.h b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/main.h
new file mode 100644
index 0000000..31cb9c0
--- /dev/null
+++ b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/main.h
@@ -0,0 +1,78 @@
+
+//----------------------------
+// integer to ascii (itoa) with util functions
+//----------------------------
+
+// function to swap two numbers
+void swap(char *x, char *y) {
+ char t = *x; *x = *y; *y = t;
+}
+
+// function to reverse buffer[i..j]
+char* reverse(char *buffer, int i, int j) {
+ while (i < j)
+ swap(&buffer[i++], &buffer[j--]);
+ return buffer;
+}
+
+// Iterative function to implement itoa() function in C
+char* itoa(int value, char* buffer, int base) {
+ // invalid input
+ if (base < 2 || base > 32)
+ return buffer;
+ // consider absolute value of number
+ int n = (value < 0) ? -value : value;
+ int i = 0;
+ while (n) {
+ int r = n % base;
+ if (r >= 10)
+ buffer[i++] = 65 + (r - 10);
+ else
+ buffer[i++] = 48 + r;
+ n = n / base;
+ }
+
+ // if number is 0
+ if (i == 0)
+ buffer[i++] = '0';
+
+ // If base is 10 and value is negative, the resulting string
+ // is preceded with a minus sign (-)
+ // With any other base, value is always considered unsigned
+ if (value < 0 && base == 10)
+ buffer[i++] = '-';
+
+ buffer[i] = '\0'; // null terminate string
+
+ // reverse the string and return it
+ return reverse(buffer, 0, i - 1);
+}
+
+//----------------------------
+// print, println, dbgprint
+//----------------------------
+
+void print(const char*str){
+ while(*str){
+ uart_write(UART,*str);
+ str++;
+ }
+}
+void println(const char*str){
+ print(str);
+ uart_write(UART,'\n');
+}
+
+void dbgPrintln(const char*str){
+ #if DEBUG == 1
+ println(str);
+ #else
+ void;
+ #endif
+}
+
+void delay(uint32_t loops){
+ for(int i=0;i<loops;i++){
+ int tmp = GPIO_A->OUTPUT;
+ }
+} \ No newline at end of file
diff --git a/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/murax.h b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/murax.h
new file mode 100644
index 0000000..9d7b7e7
--- /dev/null
+++ b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/murax.h
@@ -0,0 +1,20 @@
+#ifndef __MURAX_H__
+#define __MURAX_H__
+
+#include "timer.h"
+#include "prescaler.h"
+#include "interrupt.h"
+#include "gpio.h"
+#include "uart.h"
+#include "gcd.h"
+
+#define GPIO_A ((Gpio_Reg*)(0xF0000000))
+#define TIMER_PRESCALER ((Prescaler_Reg*)0xF0020000)
+#define TIMER_INTERRUPT ((InterruptCtrl_Reg*)0xF0020010)
+#define TIMER_A ((Timer_Reg*)0xF0020040)
+#define TIMER_B ((Timer_Reg*)0xF0020050)
+#define UART ((Uart_Reg*)(0xF0010000))
+#define GCD ((Gcd_Reg*)(0xF0030000))
+
+
+#endif /* __MURAX_H__ */
diff --git a/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/prescaler.h b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/prescaler.h
new file mode 100644
index 0000000..6bd9694
--- /dev/null
+++ b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/prescaler.h
@@ -0,0 +1,16 @@
+#ifndef PRESCALERCTRL_H_
+#define PRESCALERCTRL_H_
+
+#include <stdint.h>
+
+
+typedef struct
+{
+ volatile uint32_t LIMIT;
+} Prescaler_Reg;
+
+static void prescaler_init(Prescaler_Reg* reg){
+
+}
+
+#endif /* PRESCALERCTRL_H_ */
diff --git a/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/timer.h b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/timer.h
new file mode 100644
index 0000000..1577535
--- /dev/null
+++ b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/timer.h
@@ -0,0 +1,20 @@
+#ifndef TIMERCTRL_H_
+#define TIMERCTRL_H_
+
+#include <stdint.h>
+
+
+typedef struct
+{
+ volatile uint32_t CLEARS_TICKS;
+ volatile uint32_t LIMIT;
+ volatile uint32_t VALUE;
+} Timer_Reg;
+
+static void timer_init(Timer_Reg *reg){
+ reg->CLEARS_TICKS = 0;
+ reg->VALUE = 0;
+}
+
+
+#endif /* TIMERCTRL_H_ */
diff --git a/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/uart.h b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/uart.h
new file mode 100644
index 0000000..c3a30a5
--- /dev/null
+++ b/VexRiscv/doc/gcdPeripheral/src/main/c/murax/gcd_world/src/uart.h
@@ -0,0 +1,42 @@
+#ifndef UART_H_
+#define UART_H_
+
+
+typedef struct
+{
+ volatile uint32_t DATA;
+ volatile uint32_t STATUS;
+ volatile uint32_t CLOCK_DIVIDER;
+ volatile uint32_t FRAME_CONFIG;
+} Uart_Reg;
+
+enum UartParity {NONE = 0,EVEN = 1,ODD = 2};
+enum UartStop {ONE = 0,TWO = 1};
+
+typedef struct {
+ uint32_t dataLength;
+ enum UartParity parity;
+ enum UartStop stop;
+ uint32_t clockDivider;
+} Uart_Config;
+
+static uint32_t uart_writeAvailability(Uart_Reg *reg){
+ return (reg->STATUS >> 16) & 0xFF;
+}
+static uint32_t uart_readOccupancy(Uart_Reg *reg){
+ return reg->STATUS >> 24;
+}
+
+static void uart_write(Uart_Reg *reg, uint32_t data){
+ while(uart_writeAvailability(reg) == 0);
+ reg->DATA = data;
+}
+
+static void uart_applyConfig(Uart_Reg *reg, Uart_Config *config){
+ reg->CLOCK_DIVIDER = config->clockDivider;
+ reg->FRAME_CONFIG = ((config->dataLength-1) << 0) | (config->parity << 8) | (config->stop << 16);
+}
+
+#endif /* UART_H_ */
+
+