add some test *.cpk master
authoryu.dongliang <18588496441@163.com>
Wed, 21 Aug 2024 07:36:33 +0000 (15:36 +0800)
committeryu.dongliang <18588496441@163.com>
Wed, 21 Aug 2024 07:36:33 +0000 (15:36 +0800)
cpk/Makefile
cpk/or_gate.c
examples/add.cpk [new file with mode: 0644]
examples/and.cpk [new file with mode: 0644]
examples/or.cpk [new file with mode: 0644]
examples/or_gate.cpk [new file with mode: 0644]

index 2f54c61718bed22b406cc8cb993ba17d84e873a3..30e65c5c512ce10d1ac234d788f3e7f0eb8efc9f 100644 (file)
@@ -1,8 +1,8 @@
-CFILES += nand.c
+#CFILES += nand.c
 #CFILES += nor.c
 #CFILES += not.c
 #CFILES += and_gate.c
-#CFILES += or_gate.c
+CFILES += or_gate.c
 #CFILES += add_gate.c
 CFILES += ../scf_eda_pack.c
 CFILES += ../pack/scf_pack.c
index 854c884af453c91e2bc6f327e623bbce9995ec0a..36b42e3ddef9ad72579cace5f57165992c18abd4 100644 (file)
@@ -9,6 +9,8 @@ int main(int argc, char* argv[])
 
        ScfEcomponent* NOR0;
        ScfEcomponent* NOT0;
+       ScfEcomponent* R0;
+       ScfEcomponent* R1;
 
        ScfEfunction*  f;
        ScfEboard*     b;
@@ -17,6 +19,8 @@ int main(int argc, char* argv[])
        f = scf_efunction__alloc("or_gate");
 
        EDA_INST_ADD_COMPONENT(f, B,  SCF_EDA_Battery);
+       EDA_INST_ADD_COMPONENT(f, R0, SCF_EDA_Resistor);
+       EDA_INST_ADD_COMPONENT(f, R1, SCF_EDA_Resistor);
 
        B->pins[SCF_EDA_Battery_NEG]->flags = SCF_EDA_PIN_NEG;
        B->pins[SCF_EDA_Battery_POS]->flags = SCF_EDA_PIN_POS;
@@ -24,16 +28,19 @@ int main(int argc, char* argv[])
        EDA_INST_ADD_COMPONENT(f, NOR0, SCF_EDA_NOR);
        EDA_INST_ADD_COMPONENT(f, NOT0, SCF_EDA_NOT);
 
-       EDA_PIN_ADD_PIN(B,    SCF_EDA_Battery_POS, NOR0, SCF_EDA_NAND_POS);
-       EDA_PIN_ADD_PIN(B,    SCF_EDA_Battery_NEG, NOR0, SCF_EDA_NAND_NEG);
+       EDA_PIN_ADD_PIN(B,    SCF_EDA_Battery_POS, NOR0, SCF_EDA_NOR_POS);
+       EDA_PIN_ADD_PIN(B,    SCF_EDA_Battery_NEG, NOR0, SCF_EDA_NOR_NEG);
 
        EDA_PIN_ADD_PIN(B,    SCF_EDA_Battery_POS, NOT0, SCF_EDA_NOT_POS);
        EDA_PIN_ADD_PIN(B,    SCF_EDA_Battery_NEG, NOT0, SCF_EDA_NOT_NEG);
 
        EDA_PIN_ADD_PIN(NOR0, SCF_EDA_NOR_OUT,     NOT0, SCF_EDA_NOT_IN);
 
-       NOR0->pins[SCF_EDA_NOR_IN0]->flags = SCF_EDA_PIN_IN | SCF_EDA_PIN_IN0;
-       NOR0->pins[SCF_EDA_NOR_IN1]->flags = SCF_EDA_PIN_IN;
+       EDA_PIN_ADD_PIN(R0,   0,                   NOR0, SCF_EDA_NOR_IN0);
+       EDA_PIN_ADD_PIN(R1,   0,                   NOR0, SCF_EDA_NOR_IN1);
+
+       R0->pins[1]->flags = SCF_EDA_PIN_IN | SCF_EDA_PIN_IN0;
+       R1->pins[1]->flags = SCF_EDA_PIN_IN;
 
        NOT0->pins[SCF_EDA_NOT_OUT]->flags = SCF_EDA_PIN_OUT;
 
diff --git a/examples/add.cpk b/examples/add.cpk
new file mode 100644 (file)
index 0000000..12d89f4
Binary files /dev/null and b/examples/add.cpk differ
diff --git a/examples/and.cpk b/examples/and.cpk
new file mode 100644 (file)
index 0000000..3fa8216
Binary files /dev/null and b/examples/and.cpk differ
diff --git a/examples/or.cpk b/examples/or.cpk
new file mode 100644 (file)
index 0000000..870e194
Binary files /dev/null and b/examples/or.cpk differ
diff --git a/examples/or_gate.cpk b/examples/or_gate.cpk
new file mode 100644 (file)
index 0000000..488ccf8
Binary files /dev/null and b/examples/or_gate.cpk differ