CREATE TABLE CORE (
    coreid INTEGER PRIMARY KEY,
    core text,
    coredef text);

CREATE INDEX coredef_index ON CORE(coredef);

CREATE TABLE PLATFORM (
    platformid INTEGER PRIMARY KEY,
    platform text );

CREATE INDEX platform_index ON PLATFORM(platform);

CREATE TABLE COMPILERKIND (
    compilerkindid INTEGER PRIMARY KEY, 
    compiler text);

CREATE INDEX compilerkind_index ON COMPILERKIND(compiler);

CREATE TABLE COMPILER (
    compilerid INTEGER PRIMARY KEY,
    compilerkindid INTEGER ,
    version text,
    date text,
    FOREIGN KEY(compilerkindid) REFERENCES COMPILERKIND(compilerkindid)
    );

CREATE INDEX compiler_index ON COMPILER(compilerkindid,version);
CREATE INDEX compiler_date_index ON COMPILER(date);
CREATE INDEX compiler_all_index ON COMPILER(compilerkindid,version,date);

CREATE TABLE TYPE (
    typeid INTEGER PRIMARY KEY,
    type text );

CREATE INDEX type_index ON TYPE(type);

CREATE TABLE CATEGORY (
    categoryid INTEGER PRIMARY KEY,
    category text);

CREATE INDEX category_index ON CATEGORY(category);

CREATE TABLE CONFIG (
    configid INTEGER PRIMARY KEY,
    compilerid INTEGER,
    platformid INTEGER,
    coreid INTEGER,
    date text,
    FOREIGN KEY(compilerid) REFERENCES COMPILER(compilerid),
    FOREIGN KEY(platformid) REFERENCES PLATFORM(platformid),
    FOREIGN KEY(coreid) REFERENCES CORE(coreid)
);

INSERT INTO TYPE VALUES(1, "q7");
INSERT INTO TYPE VALUES(2, "q15");
INSERT INTO TYPE VALUES(3, "q31");
INSERT INTO TYPE VALUES(4, "f16");
INSERT INTO TYPE VALUES(5, "f32");
INSERT INTO TYPE VALUES(6, "f64");
INSERT INTO TYPE VALUES(7, "s8");
INSERT INTO TYPE VALUES(8, "u8");
INSERT INTO TYPE VALUES(9, "s16");
INSERT INTO TYPE VALUES(10,"u16");
INSERT INTO TYPE VALUES(11,"s32");
INSERT INTO TYPE VALUES(12,"u32");
INSERT INTO TYPE VALUES(13,"s64");
INSERT INTO TYPE VALUES(14,"u64");

INSERT INTO COMPILERKIND VALUES(1,"AC6");
INSERT INTO COMPILERKIND VALUES(2,"GCC");


INSERT INTO CORE VALUES(1,"m0","ARMCM0");
INSERT INTO CORE VALUES(2,"m0p","ARMCM0P");
INSERT INTO CORE VALUES(3,"m3","ARMCM3");
INSERT INTO CORE VALUES(4,"m4f","ARMCM4_FP");
INSERT INTO CORE VALUES(5,"m7","ARMCM7_DP");
INSERT INTO CORE VALUES(6,"m23","ARMCM23");
INSERT INTO CORE VALUES(7,"m33","ARMCM33_DSP_FP");
INSERT INTO CORE VALUES(8,"m35","ARMCM35P_DSP_FP");
INSERT INTO CORE VALUES(9,"a5","ARMCA5");
INSERT INTO CORE VALUES(10,"a7","ARMCA7");
INSERT INTO CORE VALUES(11,"a9","ARMCA9");
INSERT INTO CORE VALUES(12,"a15","ARMCA15");
INSERT INTO CORE VALUES(13,"helium","ARMv81MML_DSP_DP_MVE_FP");
