Super-simplified: Programming high performance code by considering cache

  • Code/data locality (compactness, % of each cache line that gets used)

  • Predictable access patterns: pre-fetch (instructions and data) friendly. This explains branching costs, why linear transversal might be faster than trees at smaller scales because of pointer chasing, why bubble sort is the fastest if the chunks fit in the cache.

  • Avoid false sharing: shared cache line unnecessarily with other threads/cores (due to how the data is packed) might have cache invalidating each other when anyone writes.

Loading

Super-simplified: What is a topology

‘Super-simplified’ is my series of brief notes that summarizes what I have learned so I can pick it up at no time. That means summarizing an hour of lecture into a few takeaway points.

These lectures complemented my gap in understanding open sets in undergrad real analysis, which I understood it under the narrow world-view of the real line.


X: Universal set

Topology ≡ open + \left\{\varnothing, X\right\}

Open ≡ preserved under unions, and finite intersections.

Why finite needed for intersections only? Infinite intersections can squeeze open edge points to limit points, e.g. \bigcap^{\infty}_{n}(-\frac{1}{n},\frac{1}{n}) = \left\{0\right\}.

Never forget that \left\{\varnothing, X\right\} is always there because it might not have properties that the meat open set B doesn’t have. e.g. a discrete topology of \mathbb{Q} on (0,1) = B \subseteq universal set X=\mathbb{R} means for any irrational point, \mathbb{R} is the only open-neighborhood (despite it looks far away) because they cannot be ‘synthesized*’ from \mathbb{Q} using operation that preserves openness.

* ‘synthesized’ in here means constructed from union and/or finite intersections.


[Bonus] What I learned from real line topology in real analysis 101:

  1. Normal intuitive cases
  2. Null and universal set are clopen
  3. Look into rationals (countably infinite) and irrationals (uncountable)
  4. Blame Cantor (sets)!

 

 

Loading

EMC PCB Layout Notes

  • Implicit RLC (potentially filters) and antennas formed by traces
  • Large ground/voltage planes serves as EMI shield, low impedance path current sink
  • True differential signals can be generated by current sources
  • Decouple with ferrite beads if radiation inevitable by geometry/placement
  • Avoid / minimize large current swings on analog plane (e.g. buffer digital signals)
  • Star ground when splitting sections: don’t let heavy digital current sink through analog ground by cascading the grounds.
  • Don’t really need to split planes as long as large digital current’s preferred return paths are localized and far away from the analog section.
  • AGND/DGND refers to the grounds responsible for different sections of a mixed-signal IC. Has nothing to do with which actual ground to tie to. (e.g. DGND pin in ADC chips still goes to analog ground plane as it has low switching current)

Loading

TDS 500 600 Series (and TDS 820) Monochrome CRT Horizontal Linearity

I have a batch of TDS 620A which everything looks shiny new, but the display will stretch vertically and eventually gone unstable after turning it on continuously for a long time.

Turns out there’s a specific batch of flyback transformer (120-1841-00) on the monochrome CRT driver board (640-0071-06) that has quite a bit of infant mortality. The newer the unit looks (of the CRT tube looks shiny new without burn-in), the more likely it’s a victim of the bad batch.

The transformer is almost impossible to source (other than getting another CRT driver board), but I was able to find a Chinese supplier who makes it. It was usable, but it’s a nightmare to get it on because it’s really done with the stereotypical Chinese (PRC) manufacturing caliber.  When I received the unit, it’s a WTF moment! Leave me a comment if you want me to write about it.

The replacement transformer is only pin and functionality compatible, but it’s not a drop in replacement (not even geometrically). The characteristics are different and I had to adjust the trimmers all over the place.

I was able to get the screen width I want by adjusting the variable inductor (L105, HOR SIZE) by nearly pulling ferrite rod out, but the horizontal linearity was way off (the left side is very squeezed):

I looked into the TDS520B Component Service Manual (Same CRT board circuit diagram) and found this:

But L100 looks like this, which doesn’t seems trimmable:

The right hand side is the same L100 choke I extracted from a CRT driver board (same model) that I’ve disposed of. I saw two suspicious pieces of metal-like objects strapped on the choke on the left (installed) which I haven’t seen in other identical boards. 

Thinking that by changing the magnetic property of the core, I can adjust the inductance of an otherwise non-adjustable inductor. I took a few bits of magnets sitting on my bench and swing it around the L100 choke, the horizontal display widens/narrows depending on which pole of the magnet is facing the L100 choke.

After a few trial and error, I picked the right amount of magnet discs to correct the horizontal linearity so the squares have roughly the same width:

I guess I cracked the code! Here’s the result of correction by magnet:

 

Loading