Commit b093db62 authored by Bjarne Wintermann's avatar Bjarne Wintermann
Browse files

Started parser for incoming data

parent d8444ebc
// Automatically generated by the MonitoringComponent during SoC Building
#define BITS_PER_ENTRY 84
#define NUM_ELEMENTS 100
char *traceNames[11] = {
"0adr",
"0we",
"0sel",
"0ack",
"0err",
"1adr",
"1we",
"1sel",
"1ack",
"1err",
"csls",
};
int traceBitLengths[11] = {
30,
1,
4,
1,
1,
30,
1,
4,
1,
1,
10,
};
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <irq.h>
#include <uart.h>
......@@ -9,6 +10,31 @@
#include "monitor_component_constants.h"
unsigned long fifoContents[NUM_ELEMENTS * BITS_PER_ENTRY / 32];
int currentEntry = 0;
int currentArrayIndex = 0;
int currentBitInArrayElement = 0;
int currentTrace = 0;
void printNextEntry(void) {
if (currentEntry == NUM_ELEMENTS) {
printf("Finished printing every entry!\n");
currentEntry = 0;
currentArrayIndex = 0;
currentBitInArrayElement = 0;
currentTrace = 0;
return;
}
printf("Entry %d:\n", currentEntry);
// Increase currentEntry every BITS_PER_ENTRY bits
for (currentTrace = 0; currentTrace < NUM_TRACES; currentTrace++) {
currentBitInArrayElement += traceBitLengths[currentTrace];
printf("%s: %lu", traceNames[currentTrace], (unsigned long) (fifoContents[currentArrayIndex] << currentBitInArrayElement) & pow(2, traceBitLengths[currentTrace]-1));
}
}
void start_dma_writing(void) {
// Tell design that addressdata is now valid to write to
monitoringComponent_dma_writeEnable_write(1);
......@@ -26,7 +52,7 @@ int main(void) {
uart_init();
printf("Monitoring started...\n");
unsigned long fifoContents[NUM_ELEMENTS];
printf("Array address: %p\n", (void*) &fifoContents[0]);
// Clean array
......
......@@ -108,7 +108,15 @@ class DMAMonitoringComponent(Module, AutoCSR):
f.write("// Automatically generated by the MonitoringComponent during SoC Building\n")
f.write(f"#define BITS_PER_ENTRY {sum([l for _,l in self.interfaceMonitor.outLayout])}\n")
f.write(f"#define NUM_ELEMENTS {numElementsToSave}\n")
f.write(f"#define NUM_TRACES {len(self.interfaceMonitor.outLayout)}\n")
f.write(f"char *traceNames[{len(self.interfaceMonitor.outLayout)}] = {{\n")
for n,_ in self.interfaceMonitor.outLayout:
f.write(f"\t\"{n}\",\n")
f.write("};\n")
f.write(f"int traceBitLengths[{len(self.interfaceMonitor.outLayout)}] = {{\n")
for _,l in self.interfaceMonitor.outLayout:
f.write(f"\t{l},\n")
f.write("};\n")
class GearboxMonitoringComponent(Module, AutoCSR):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment