Merge branch 'python-dev-new' of github.com:hqjenny/centrifuge into python-dev-new

This commit is contained in:
Jenny Huang 2023-09-02 09:55:29 -07:00
commit 389e117c1a
45 changed files with 308 additions and 6 deletions

View File

@ -0,0 +1,25 @@
VERBOSE= 1
TARGET ?=adpcm
FUNC=encode
LDFLAGS=
CFLAGS=
ifeq ($(CUSTOM_INST), 1)
CFLAGS+=-DCUSTOM_INST
endif
ifeq ($(CUSTOM_DRIVER), 1)
CFLAGS+=-DCUSTOM_DRIVER
endif
ifeq ($(LLVM), 1)
ACCEL ?=0
include ../../../../Makefile.llvm.in
else
ifeq ($(GCC), 1)
include ../../../../Makefile.gcc.in
else
include ../../../../Makefile.bm.in
endif
endif

View File

@ -0,0 +1,11 @@
{
"RoCC": {
"custom0": {
"pgm": "adpcm",
"func": "encode",
"srcs": [
"adpcm.c"
]
}
}
}

View File

@ -0,0 +1,25 @@
VERBOSE= 1
TARGET ?=adpcm_tl
FUNC=encode
LDFLAGS=
CFLAGS=
ifeq ($(CUSTOM_INST), 1)
CFLAGS+=-DCUSTOM_INST
endif
ifeq ($(CUSTOM_DRIVER), 1)
CFLAGS+=-DCUSTOM_DRIVER
endif
ifeq ($(LLVM), 1)
ACCEL ?=0
include ../../../../Makefile.llvm.in
else
ifeq ($(GCC), 1)
include ../../../../Makefile.gcc.in
else
include ../../../../Makefile.bm.in
endif
endif

View File

@ -0,0 +1,12 @@
{
"TL": [
{
"pgm": "adpcm_tl",
"func": "encode",
"addr": "0x30000",
"srcs": [
"adpcm_tl.c"
]
}
]
}

View File

@ -0,0 +1,25 @@
VERBOSE= 1
TARGET ?=aes
FUNC=encrypt
LDFLAGS=
CFLAGS=
ifeq ($(CUSTOM_INST), 1)
CFLAGS+=-DCUSTOM_INST
endif
ifeq ($(CUSTOM_DRIVER), 1)
CFLAGS+=-DCUSTOM_DRIVER
endif
ifeq ($(LLVM), 1)
ACCEL ?=0
include ../../../../Makefile.llvm.in
else
ifeq ($(GCC), 1)
include ../../../../Makefile.gcc.in
else
include ../../../../makefiles/Makefile.bm.in
endif
endif

View File

@ -0,0 +1,11 @@
{
"RoCC": {
"custom0": {
"pgm": "aes",
"func": "encrypt",
"srcs": [
"aes.c"
]
}
}
}

View File

@ -0,0 +1,25 @@
VERBOSE= 1
TARGET ?=aes_tl
FUNC=encrypt
LDFLAGS=
CFLAGS=
ifeq ($(CUSTOM_INST), 1)
CFLAGS+=-DCUSTOM_INST
endif
ifeq ($(CUSTOM_DRIVER), 1)
CFLAGS+=-DCUSTOM_DRIVER
endif
ifeq ($(LLVM), 1)
ACCEL ?=0
include ../../../../Makefile.llvm.in
else
ifeq ($(GCC), 1)
include ../../../../Makefile.gcc.in
else
include ../../../../Makefile.bm.in
endif
endif

View File

@ -0,0 +1,12 @@
{
"TL": [
{
"pgm": "aes_tl",
"func": "encrypt",
"addr": "0x30000",
"srcs": [
"aes_tl.c"
]
}
]
}

View File

@ -0,0 +1,25 @@
VERBOSE= 1
TARGET ?=gsm
FUNC=lpc
LDFLAGS=
CFLAGS=
ifeq ($(CUSTOM_INST), 1)
CFLAGS+=-DCUSTOM_INST
endif
ifeq ($(CUSTOM_DRIVER), 1)
CFLAGS+=-DCUSTOM_DRIVER
endif
ifeq ($(LLVM), 1)
ACCEL ?=0
include ../../../../Makefile.llvm.in
else
ifeq ($(GCC), 1)
include ../../../../Makefile.gcc.in
else
include ../../../../Makefile.bm.in
endif
endif

View File

@ -0,0 +1,11 @@
{
"RoCC": {
"custom0": {
"pgm": "gsm",
"func": "lpc",
"srcs": [
"gsm.c"
]
}
}
}

View File

@ -0,0 +1,25 @@
VERBOSE= 1
TARGET ?=gsm_tl
FUNC=lpc
LDFLAGS=
CFLAGS=
ifeq ($(CUSTOM_INST), 1)
CFLAGS+=-DCUSTOM_INST
endif
ifeq ($(CUSTOM_DRIVER), 1)
CFLAGS+=-DCUSTOM_DRIVER
endif
ifeq ($(LLVM), 1)
ACCEL ?=0
include ../../../../Makefile.llvm.in
else
ifeq ($(GCC), 1)
include ../../../../Makefile.gcc.in
else
include ../../../../Makefile.bm.in
endif
endif

View File

@ -0,0 +1,12 @@
{
"TL": [
{
"pgm": "gsm_tl",
"func": "lpc",
"addr": "0x30000",
"srcs": [
"gsm_tl.c"
]
}
]
}

View File

@ -0,0 +1,26 @@
VERBOSE= 1
TARGET ?=sha
FUNC=sha_update
LDFLAGS=
CFLAGS=
ifeq ($(CUSTOM_INST), 1)
CFLAGS+=-DCUSTOM_INST
endif
ifeq ($(CUSTOM_DRIVER), 1)
CFLAGS+=-DCUSTOM_DRIVER
endif
ifeq ($(LLVM), 1)
ACCEL ?=0
include ../../../../Makefile.llvm.in
else
ifeq ($(GCC), 1)
include ../../../../Makefile.gcc.in
else
include ../../../../Makefile.bm.in
endif
endif

View File

@ -232,7 +232,7 @@ sha_stream ()
sha_info_data[16+5 +1] = 0;
//sha_init ();
uint64_t begin, end, dur;
int begin, end, dur;
for (j = 0; j < VSIZE; j++)
{

View File

@ -0,0 +1,11 @@
{
"RoCC": {
"custom0": {
"pgm": "sha",
"func": "sha_update",
"srcs": [
"sha.c"
]
}
}
}

View File

@ -0,0 +1,26 @@
VERBOSE= 1
TARGET ?=sha_tl
FUNC=sha_update
LDFLAGS=
CFLAGS=
ifeq ($(CUSTOM_INST), 1)
CFLAGS+=-DCUSTOM_INST
endif
ifeq ($(CUSTOM_DRIVER), 1)
CFLAGS+=-DCUSTOM_DRIVER
endif
ifeq ($(LLVM), 1)
ACCEL ?=0
include ../../../../Makefile.llvm.in
else
ifeq ($(GCC), 1)
include ../../../../Makefile.gcc.in
else
include ../../../../Makefile.bm.in
endif
endif

View File

@ -228,6 +228,8 @@ sha_stream ()
//int sha_info_count_hi = 0L;
int sha_info_count[2]={0L, 0L};
uint64_t begin, end, dur;
sha_init ();
begin = read_cycle();
for (j = 0; j < VSIZE; j++)
@ -235,8 +237,6 @@ sha_stream ()
i = in_i[j];
p = &indata[j][0];
uint64_t begin, end, dur;
#ifdef CUSTOM_DRIVER
sha_update_wrapper(p, i, sha_info_digest, sha_info_data, sha_info_count);
#else

View File

@ -0,0 +1,12 @@
{
"TL": [
{
"pgm": "sha_tl",
"func": "sha_update",
"addr": "0x30000",
"srcs": [
"sha_tl.c"
]
}
]
}

View File

@ -14,15 +14,23 @@ with open(sys.argv[1] + "/Makefile") as f:
for line in f:
line = line.strip()
if line.startswith("TARGET"):
pgm = line.split("=")[-1]
pgm = line.split("=")[-1].strip()
elif line.startswith("FUNC"):
func = line.split("=")[-1]
func = line.split("=")[-1].strip()
accel_dict = {"pgm": pgm, "func": func}
if pgm.endswith("_tl"):
accel_dict["addr"] = "0x30000"
srcs = [filename for filename in os.listdir(sys.argv[1]) if filename.endswith(".c") or filename.endswith(".cpp") or filename.endswith(".h")]
accel_dict["srcs"] = srcs
for src in srcs:
with open(sys.argv[1] + "/" + src) as f:
src_code = f.read()
# Reformatting src_code in case "int main" is formatted weirdly
src_code = " ".join(src_code.split())
if "int main" in src_code:
accel_dict["srcs"] = [src]
break
if pgm.endswith("_tl"):
res = {"TL": [accel_dict]}