From 930bfd3c8bda92507f7d6dd4988ee8eabe8e34aa Mon Sep 17 00:00:00 2001 From: Carl Allendorph Date: Thu, 17 Oct 2024 14:24:55 -0700 Subject: [PATCH 1/3] Updated microwire name to avoid ambiguous naming The variadic function was ambiguous with the default 4-wire version, so I've renamed it. --- src/bundles/comms.stanza | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/bundles/comms.stanza b/src/bundles/comms.stanza index 4d55ddd7..1f2c5d79 100644 --- a/src/bundles/comms.stanza +++ b/src/bundles/comms.stanza @@ -371,8 +371,6 @@ Microwire is a subset of SPI with slightly different latching requirements. It often comes in a 3-wire variant. - - @member clk Synchronous clock - Required Port @member cs Chip Select - Optional Port @member do Data Output - Optional Port @@ -423,7 +421,7 @@ interface. @member di Data Input -public defn microwire (): +public defn microwire-4 (): microwire(Microwire-CS, Microwire-DO, Microwire-DI) From 4d86b0378e82de24fe8a42ef9e12dc055af89ebe Mon Sep 17 00:00:00 2001 From: Carl Allendorph Date: Thu, 17 Oct 2024 14:25:43 -0700 Subject: [PATCH 2/3] Updated pullup/pulldown helper functions --- src/circuits/Pullups.stanza | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/src/circuits/Pullups.stanza b/src/circuits/Pullups.stanza index 650689f5..77d32e07 100644 --- a/src/circuits/Pullups.stanza +++ b/src/circuits/Pullups.stanza @@ -82,8 +82,19 @@ to `IRQ_N-pu`. @param qb? Optional Resistor query builder for the selection of the pullup resistor in the case that `elem-type?` is a `Double`. By default, the global query defaults are extended with `ResistorQuery(precision = (5 %))`. +@param make-public Determines if the created resistor instance will be defined +with the `public` access modifier or not. By default, the component is defined as +`private` -public defn insert-pullup (sig:JITXObject, rail:JITXObject -- elem-type:Instantiable|Double = 10.0e3, inst-name?:String|Symbol = ?, qb?:ResistorQuery = ?) : +public defn insert-pullup ( + sig:JITXObject, + rail:JITXObject + -- + elem-type:Instantiable|Double = 10.0e3, + inst-name?:String|Symbol = ?, + qb?:ResistorQuery = ?, + make-public:True|False = false + ) -> Instance: val inst-name = to-string $ value-or(inst-name?, "%_-pu" % [get-ref-name $ ref(sig)]) val qb = value-or(qb?, PULLUP_DEF_QB) @@ -93,8 +104,9 @@ public defn insert-pullup (sig:JITXObject, rail:JITXObject -- elem-type:Instanti (R-v:Double): ; Resistance Value create-resistor(resistance = R-v, precision = (1 %)) - val elem = make-inst(to-symbol(inst-name), et, false) + val elem = make-inst(to-symbol(inst-name), et, make-public) add-pullup(elem, sig, rail) + elem doc: \ Construct a pulldown instance from an Instantiable @@ -116,8 +128,19 @@ to `IRQ_N-pu`. @param qb? Optional Resistor query builder for the selection of the pullup resistor in the case that `elem-type?` is a `Double`. By default, the global query defaults are extended with `ResistorQuery(precision = (5 %))`. +@param make-public Determines if the created resistor instance will be defined +with the `public` access modifier or not. By default, the component is defined as +`private` -public defn insert-pulldown (sig:JITXObject, rail:JITXObject -- elem-type:Instantiable|Double = 10.0e3, inst-name?:String|Symbol = ?, qb?:ResistorQuery = ?) : +public defn insert-pulldown ( + sig:JITXObject, + rail:JITXObject + -- + elem-type:Instantiable|Double = 10.0e3, + inst-name?:String|Symbol = ?, + qb?:ResistorQuery = ?, + make-public:True|False = false + ) -> Instance: val inst-name = to-string $ value-or(inst-name?, "%_-pd" % [get-ref-name $ ref(sig)]) val qb = value-or(qb?, PULLUP_DEF_QB) @@ -127,6 +150,6 @@ public defn insert-pulldown (sig:JITXObject, rail:JITXObject -- elem-type:Instan (R-v:Double): ; Resistance Value create-resistor(qb, resistance = R-v) - val elem = make-inst(to-symbol(inst-name), et, false) + val elem = make-inst(to-symbol(inst-name), et, make-public) add-pulldown(elem, sig, rail) - + elem From 4ca5ecf05cd0cad52a59ae296c182288509bb599 Mon Sep 17 00:00:00 2001 From: Carl Allendorph Date: Thu, 17 Oct 2024 14:26:22 -0700 Subject: [PATCH 3/3] Added 'Termination' module with initial termination modules --- src/circuits.stanza | 2 +- src/circuits/Termination.stanza | 35 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/circuits/Termination.stanza diff --git a/src/circuits.stanza b/src/circuits.stanza index 0830b7d5..0ed21553 100644 --- a/src/circuits.stanza +++ b/src/circuits.stanza @@ -6,5 +6,5 @@ defpackage jsl/circuits: forward jsl/circuits/CrystalResonator forward jsl/circuits/Network forward jsl/circuits/Pullups + forward jsl/circuits/Termination forward jsl/circuits/utils - \ No newline at end of file diff --git a/src/circuits/Termination.stanza b/src/circuits/Termination.stanza new file mode 100644 index 00000000..9932dec0 --- /dev/null +++ b/src/circuits/Termination.stanza @@ -0,0 +1,35 @@ +#use-added-syntax(jitx) +defpackage jsl/circuits/Termination: + import core + import jitx + import jitx/parts + + +doc: \ +Create a typical shield termination + +This type is intended mostly for prototypes where the +exact termination requirements aren't completely known. +We're giving ourselves options for testing. + +Default is a simple RC parallel circuit. + +@member SHIELD Connected to the shield of a connector, etc. +@member GND Ground plane connection for the termination. + +@param R-query Resistor query parameters - default is `ResistorQuery()`. +@param C-query Capacitor query parameters. Default sets a min rated +voltage of 50.0V. + +public defn shield-termination ( + R-query:ResistorQuery = ResistorQuery(), + C-query:CapacitorQuery = CapacitorQuery(rated-voltage = AtLeast(50.0)) + ) -> Instantiable: + + pcb-module shield-term-t : + port SHIELD + port GND + insert-resistor(SHIELD, GND, R-query, resistance = 0.0, inst-name = "R") + insert-capacitor(SHIELD, GND, C-query, capacitance = 4.7e-9, inst-name = "C") + + shield-term-t \ No newline at end of file