summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDaniel Biester <danielbiester@icloud.com>2020-09-24 14:15:23 +0200
committerDaniel Biester <danielbiester@icloud.com>2020-09-24 14:16:40 +0200
commitee9f578298f07bb17b568bea73495c49b80522f4 (patch)
treed56207050be82c493e10a08ad6592cd75dde2a0b
parent6674aba2f2678620a02732d9eb51762bce40d072 (diff)
Added libsi directory for SI initialization code.firm2vhdl
-rw-r--r--libsi/Makefile2
-rw-r--r--libsi/si.c39
-rw-r--r--si.obin1744 -> 0 bytes
-rw-r--r--src/ast/attribute.c2
-rw-r--r--src/driver/c_driver.c3
5 files changed, 41 insertions, 5 deletions
diff --git a/libsi/Makefile b/libsi/Makefile
new file mode 100644
index 0000000..bb3f07e
--- /dev/null
+++ b/libsi/Makefile
@@ -0,0 +1,2 @@
+si.o:
+ cparser -target sparc-invasic-octopos -c -o si.o si.c
diff --git a/libsi/si.c b/libsi/si.c
new file mode 100644
index 0000000..41a3847
--- /dev/null
+++ b/libsi/si.c
@@ -0,0 +1,39 @@
+#include <stdint.h>
+
+#define SISTATEBASE 0xD0001000
+#define SISTATEADDRESS(sigrp,si) (SISTATEBASE + ((sigrp) << 7) + ((si) << 2))
+#define SSM_ENTRY(isavailable, vlcwaddress, vlcwlength) (((isavailable) << 17) | (vlcwaddress) << 8 | (vlcwlength))
+#define VLCW_START_ADDR 0xD0100000 // proFPGA
+
+#define WORDS_IN_VLCW_LINE 32
+
+#define si_words_per_vlcw 27
+
+volatile unsigned int* si_state_mem;
+static unsigned int si_vlcws[][si_words_per_vlcw] = {
+ {0x4,0xFFEEFFFF,0xFFFF,0xFFFF8000,0xFFFFFFFF,0xFFFF,0xFFFF8000,0x0,0x0,0x0,0x0,0xFFEEFFFF,0xFFFF,0x0,0xFFFFFFFF,0xFFFF,0x0,0xFFFFF6FF,0x100000,0xFFFFF6FF,0x100000,0xFFFFF6FF,0x100000,0xFFFFF6FF,0x100000,0xFFFFFF20,0x302040},
+ {0x4,0xFFFFFFFF,0xFFEE,0xFFFF8000,0xFFFFFFFF,0xFFFF,0xFFFF8000,0x0,0x0,0x0,0x0,0xFFFFFFFF,0xFFEE,0x0,0xFFFFFFFF,0xFFFF,0x0,0xFF6FFFFF,0x100000,0xFF6FFFFF,0x100000,0xFF6FFFFF,0x100000,0xFF6FFFFF,0x100000,0xFC8FFFFF,0x100000}
+};
+
+int si_num_steps = 2;
+
+void si_state_memory_update(unsigned int si_grp, unsigned int si_id, unsigned char si_active, unsigned int si_vlcw_start, unsigned int si_vlcw_length) {
+ si_state_mem = (unsigned int *)SISTATEADDRESS(si_grp, si_id);
+ *(si_state_mem) = SSM_ENTRY(si_active, si_vlcw_start, si_vlcw_length);
+}
+
+void load_si_micro_program(unsigned int num_steps, unsigned int words_per_vlcw, unsigned int words_in_vlcw_line, unsigned int *micro_program) {
+ int i, j;
+ volatile unsigned int *vlcw_mem = (unsigned int *)VLCW_START_ADDR;
+ for (i = 0; i < num_steps; ++i) {
+ for (j = 0; j < words_per_vlcw; ++j) {
+ *vlcw_mem++ = micro_program[i*words_per_vlcw+j];
+ }
+ vlcw_mem += words_in_vlcw_line - words_per_vlcw;
+ }
+}
+
+void init_si(uint32_t si_opcode) {
+ load_si_micro_program(si_num_steps, si_words_per_vlcw, WORDS_IN_VLCW_LINE, si_vlcws[0]);
+ si_state_memory_update(0, si_opcode, 1, 0, si_num_steps); //The number five was arbitrarily chosen
+}
diff --git a/si.o b/si.o
deleted file mode 100644
index 9367642..0000000
--- a/si.o
+++ /dev/null
Binary files differ
diff --git a/src/ast/attribute.c b/src/ast/attribute.c
index 02be161..6b42462 100644
--- a/src/ast/attribute.c
+++ b/src/ast/attribute.c
@@ -252,8 +252,6 @@ static void handle_attribute_special_instruction(const attribute_t *attribute, e
}
assert(entity->kind == ENTITY_FUNCTION);
entity->function.si_opcode = si_opcode & 0x1F;
- extern bool driver_link_si;
- driver_link_si = true;
}
static void warn_arguments(const attribute_t *attribute)
diff --git a/src/driver/c_driver.c b/src/driver/c_driver.c
index ee3d3a8..52f81da 100644
--- a/src/driver/c_driver.c
+++ b/src/driver/c_driver.c
@@ -69,7 +69,6 @@ struct obstack ldflags_obst;
struct obstack asflags_obst;
struct obstack codegenflags_obst;
bool construct_dep_target;
-bool driver_link_si = false;
int driver_use_integrated_preprocessor = -1;
bool driver_no_stdinc;
bool driver_verbose;
@@ -886,8 +885,6 @@ bool link_program(compilation_env_t *env, compilation_unit_t *units)
if (lsysroot)
obstack_printf(&file_obst, " --sysroot=%s", lsysroot);
- if(driver_link_si && !strcmp(ir_triple_get_cpu_type(target.machine), "sparc"))
- driver_add_flag(&file_obst, "si.o");
driver_add_flag(&file_obst, "-o");
driver_add_flag(&file_obst, outname);
obstack_printf(&file_obst, "%s", flags);