From 3b868bc055785f549f00d1cb30d28f75a5a8fb73 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Wed, 21 Aug 2024 15:36:33 +0800 Subject: [PATCH] add some test *.cpk --- cpk/Makefile | 4 ++-- cpk/or_gate.c | 15 +++++++++++---- examples/add.cpk | Bin 0 -> 1357 bytes examples/and.cpk | Bin 0 -> 739 bytes examples/or.cpk | Bin 0 -> 742 bytes examples/or_gate.cpk | Bin 0 -> 536 bytes 6 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 examples/add.cpk create mode 100644 examples/and.cpk create mode 100644 examples/or.cpk create mode 100644 examples/or_gate.cpk diff --git a/cpk/Makefile b/cpk/Makefile index 2f54c61..30e65c5 100644 --- a/cpk/Makefile +++ b/cpk/Makefile @@ -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 diff --git a/cpk/or_gate.c b/cpk/or_gate.c index 854c884..36b42e3 100644 --- a/cpk/or_gate.c +++ b/cpk/or_gate.c @@ -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 index 0000000000000000000000000000000000000000..12d89f412d4b145125cf45283b572873b2ac4195 GIT binary patch literal 1357 zcmb7^K}y6x5JgKUq`=U&5U>|n^dd+WL9)m~Tu3~MFs}6$dI3-5dbXaywI}fZ5SW=z z4VhjI^Q-==`kh4M%WfwRqGBSF2h&=UHri^Za)G~AM@3?;G-}q~EkOO{*U#PW)&0#= zxPIO5pAQb2qykA|l0oPm!u!W`(C1%@0yFdAMyZ-R|87wn!t}OoKXx7iEgIwZ2_E$F61?m}^PU&7N{0 z3rgT^%_5PO(1SZek4vLmpi#=(X$@%&df->0Q7+IZok7dI7}Td^jde2-#wSNJXe22b z4y#78>QL$?A5&h=d3E?4e`ljg@+4Y+S96#%K}dRl(hZ@X)RK~k?o70VghEi6KG5pI zoUiX;%;}6(l&}l2f5?hAL07N#!rmSJ(u70Q`?ZP6t#iY^uOKWR!6Ju9P($rp+@EhF O;;Q{Q1wcT>U%(TW%^W}g literal 0 HcmV?d00001 diff --git a/examples/or.cpk b/examples/or.cpk new file mode 100644 index 0000000000000000000000000000000000000000..870e1940fd90ea30c44e560ab30f659ff1472d3c GIT binary patch literal 742 zcmb7?JqiLr422^E2{^r&g^Y)>Uhxuo0Z(MTt!J?I1ilQyie$mvVwvGf z-pkK$=+4vKU5MEE?Xh_-wyV7^k9~g_vN=heWCB$bIk>pA;u%Lg(4K=7< z@8zqLXo8U-CSC@|DPqZHfvP?oxsx|MG7CfSL*ai-K3nP7v2Dz07SCX(E^)@tm=-oD QsLj)A>_Iuek*dRe1NR0T1^@s6 literal 0 HcmV?d00001 diff --git a/examples/or_gate.cpk b/examples/or_gate.cpk new file mode 100644 index 0000000000000000000000000000000000000000..488ccf89d1e1e1711db0ec6822754114704bd647 GIT binary patch literal 536 zcmZ`$y9ok85PiZR0}ks57I1-xkp&otRw4$6p&%Av16E{wsWn)JZ!bAHo*T{X+xM9n zYp%D`<$Q0kguwwc8AxEla&!#H3`gRd3r{(Mp9X808?Jy$ V_?N7Qbg~LXDto@_TqE=T`UMB|4<`Ts literal 0 HcmV?d00001 -- 2.25.1