HNHacker News
TopNewBestAskShowJobs

hamiltonkibbe

382 karma · joined July 17, 2013

https://hamiltonkibbe.com
submissionscomments
hamiltonkibbe··on Planned GPS outages in southern California
I suspect this is because AWS hasn't yet added an API call for placing a fleet of satellites in semi-synchronous orbit
hamiltonkibbe··on I'm skeptical of NAND mirroring
Really anything that implements the same interface, be it parallel, i2c, SPI, and ideally with the R/!W held high, disconnected, or ignored. I don't think anyone is actually considering reflowing a new IC for every try, that's completely unnecessary.
hamiltonkibbe··on Apple Encryption Engineers, If Ordered to Unlock iPhone, Might Resist
1 order of magnitude difference isn't my definition of splitting hairs
hamiltonkibbe··on Real-Time Django: Get Started with Django Channels
Yes, but the ship was guaranteed to sail no later than 8 years ago. Meanwhile, I'm still waiting for the blog post to load.
hamiltonkibbe··on Real-Time Django: Get Started with Django Channels
Can we come up with a new word for this? Real-Time has a definition w/r/t computing, and it's certainly not "Python code, running in a C runtime, on top of a non-realtime OS."
hamiltonkibbe··on Sort Faster with FPGAs
Yeah I was thinking the same thing, just compare all the registers to the value of the next item @posedge_clk and use that bit to tell the registers whether or not they need to shift their value into the next register. It replaces the `memmove()` (the abstract concept) with a single cycle shift
hamiltonkibbe··on A free shipping mystery
Nagle's algorithm[0]. So long as you haven't recieved a "Where the hell is my mail" phone call, just keep adding stuff to the second truck until that second truck fills up, and send it later.

[0]: https://en.wikipedia.org/wiki/Nagle%27s_algorithm

hamiltonkibbe··on Ask HN: How do you deal with 2000 line functions?
Apparently not, I personally find the phrase "2000 line function" offensive but that part isn't censored.
hamiltonkibbe··on A critique of "How to C in 2016"
All the code using non-optional c constructs will compile. If you're doing something that uses floating point math and expecting to run it on a 16-bit DSP, you're probably doing something wrong. The biggest hurdle isn't compiler support, rather converting all the floating point operations to fixed-point and ensuring that you have enough resolution such that rounding errors don't make your IIR filter unstable for example. That's really outside the scope of the discussion though, as that is just an aspect of practical DSP using fixed point math.
hamiltonkibbe··on A critique of "How to C in 2016"
Maybe "poorly-written" was a bit strong, but if you're making that assumption, you are by definition relying on un- or implementation-defined behavior.

The fact that a char is stored on silicon in the lowest 8 bits of the smallest addressable memory space really makes no difference. char arrays act just like they do on any other platform.

There aren't a lot of libraries floating around that you'd be using on a DSP, aside from vendor-supplied ones. Generally you're using a DSP because you have specific signal processing needs and power and cost requirements, which are pretty orthogonal to the requirements of most desktop development. As such, there probably isn't a huge amount of overlap between the libraries you'd be using.

Another reason for that being that quite a bit of the time you're not running an OS. There is no transparent abstraction layer that magically maps an ADC IC connected via SPI to an arbitrary group of remappable peripheral pins to /dev/adc0. I think that's kind of the big disconnect between desktop and embedded, so much of the code is specific to the processor/DSP and the arbitrary external hardware connected to it. You can't take code written for a DsPIC that uses the internal ADC and run it on an MSP430 with an internal ADC for the same reason. There isn't necessarily a POSIX layer, so it's a very different beast than writing code that works on UNIX, Linux, and OSX. Look at the Linux source and see how many architecture-specific files there are in each architecture's folder. That's what you need to get a consistant interface across different processors. Without all that non-portable abstraction code running below yours, posix- and standard-compliant code still wouldn't be portable.

As far as using the same standard, I think it's a good thing that there is agreement on what the effect of a given construct is. I think the issue comes when you expect that code written for one platform to just work(TM) on another.

hamiltonkibbe··on A critique of "How to C in 2016"
You voluntarily code in C for the same reason that your OS kernel's 'yield' is written in assembly. How do you push the addressing mode register to the stack when switching to another task in your high level language of choice?
hamiltonkibbe··on A critique of "How to C in 2016"
You can use char, and for the most part you won't notice any difference, until you start looking at the memory display in your IDE and have a short-lived WTF moment. A c-string looks strange in the memory view because there's a NULL octet between each character but that's an implementation detail that you don't really notice 99% of the time, because everything on the processor is designed to use 16-bit words. If you write a buffer of chars to the UART tx register, it will only put the half of the word with the character data onto the wire, just like with any other microcontroller, just like with PySerial, and just like with JS and websockets. That's why the C standard doesn't say a char is 8-bits, it just says that sizeof(char) is 1. I would argue that any code doing anything under the assumption that a char variable occupies 8 bits in memory and that the next char in an array is physically adjacent to it with no wasted space in between is just poorly-written and inherently not portable.

As for why this is the case, Generally DSPs are designed to do a few tasks very well (multiply-accumulate being the most obvious example, simultaneous reads from X and y memory, etc.) and are generally optimized for a specific word size. If you really need to access an octet on E.g. A 16-bit TI DSP you can, you just need to shift and mask. That's obviously not very efficient, because that's not really what it's optimized for. If that's what you really need, you picked the wrong part. You're gonna be filter-/FFT-/DCT-/whatever-ing way more 12 or 16-bit ADC samples per second, per dollar, and per milliWatt on that 16-bit DSP than you would be on your octet-addressable MSP430.

Regarding "Normal" c libraries, If they're valid C they should work just fine for the most part, With some obvious exceptions: you're not going to have a fun time with your "floats" on a processor without FP HW. That's why there's a standard, if you're not relying on undefined or implementation-defined behavior, you'll be fine(ish)

hamiltonkibbe··on A critique of "How to C in 2016"
Every TI DSP I've worked with uses 16-bit bytes
hamiltonkibbe··on Why the ‘wet tea leaves’ drug raid was outrageous
"As the law sees it, an officer can’t be recklessly indifferent to truth if he was never trained about, told about, or took the time to learn the truth in the first place."

It's unfortunate that police are the only ones allowed to use the "ignorantia juris" defense.

hamiltonkibbe··on Reverse Engineering a Real Candle
Yeah I understand it's entirely relative. I made that comment based on my immediate reaction. Compared to an incandescent bulb, LEDs are like the Lamborghini in my analogy
hamiltonkibbe··on Reverse Engineering a Real Candle
It's a different perspective, I've spent a significant amount of time working with LEDs in a context where the rise time is important, and the fact that LEDs are slow (in this context) provided a significant challenge.

I guess the phrase "LEDs are extremely fast" struck me the same way a pedestrian telling you "walking is the fastest way to get around" when you're stopped at a red light in a Lamborghini would

hamiltonkibbe··on Reverse Engineering a Real Candle
They're fast until you start trying to use them to transmit data at a few tens of megabits/s.

Laser diodes, on the other hand, are fast

hamiltonkibbe··on Companies to face criminal offence if they tip off U.K. users about snooping
The "unrelated" non-UK company would "license" some technology from google, and pay Google a "license fee" which is coincidentally equal to gross ad revenue less operating expenses. You know, basic undergrad-level tax dodging stuff.
hamiltonkibbe··on Moore's law hits the roof
You just replace the "C" transistors with "Javascript" transistors
hamiltonkibbe··on 1% the Code (2001)
https://github.com/atom/electron
hamiltonkibbe··on 1% the Code (2001)
But the real question is how many lines of HDL went into the design of the processor?
hamiltonkibbe··on 1% the Code (2001)
Or the OS it's running on?
hamiltonkibbe··on 'Li-fi 100 times faster than wi-fi'
IR comma doesn't the frequwncy of the light as a carrier, it uses pulsed IR (on=1 off=0 usually in the KHz range) the limitation is usually the rise time of the LEDs
hamiltonkibbe··on On FPGAs as PC Coprocessors (1996)
I'd definitely be interested in checking that out if you have a link
hamiltonkibbe··on On FPGAs as PC Coprocessors (1996)
I think a high level HDL would be great. C really isn't a good starting point because as you said it doesn't really fit the parallel hardware paradigm. The existing tools that do this feel like they're trying to shoehorn C into this application and it doesn't work too well, because of all the extra information you need to synthesize hardware, e.g. should every iteration of this loop happen simultaneously, or are you making a shift register?

Something that started with a Verilog/VHDL paradigm but provided higher level abstrations would be nice, a good analogy would be something like how Python is to C.

hamiltonkibbe··on 24/192 music downloads make no sense
The two signals which are "interfering" are added together. The amplitude of the resultant signal varies sinusoidally, as the instantaneous phase difference between the two signals goes from 0->2pi. One way of describing the signal would be that it is a separate tone (sitting in the middle of the two frequencies) being amplitude modulated by a signal at the beat frequency... which is what you hear and why you "hear" the beat frequency) I went with this way of describing the signal because you were talking about "an arbitrarily high frequency signal getting louder and softer 440 times per second" which is the definition of amplitude modulation.

Counterintuitively, there is no frequency component generated at the beat frequency when you sum a 1kHz and 1.001kHz signal, its easy to test that out with matlab, octave, scipy/numpy/matplotlib, etc. Generate the two signals, add them together, and look at the Fourier transform, you'll see two components, one at 1kHz and one at 1.001kHz (assuming you take a long enough window to have that type of resolution) and no component at the beat frequency. A third sinewave doesn't just jump out of nowhere when you add two separate sinewaves together.

If you take the sum of those two signals and run them through an ideal brickwall highpass filter at 999Hz so there are no frequency components below 999Hz, you'll still "hear" the beat frequency because it isn't a separate spectral component, its just the two signals slowly going out of phase, cancelling eachother out, and then going back in phase and boosting the amplitude.

hamiltonkibbe··on On FPGAs as PC Coprocessors (1996)
I've only done a little bit with Xilinx's HLS which allows you to write "C/C++" which gets synthesized to hardware. I put C/C++ in quotes because it relies on lots of pragma directives to tell the complier enough that it can synthesize the hardware that you want, to the point of it almost being its own language entirely, There may be a few applications where this is particularly well suited, but at least for what I was doing, it was easier (and fit my mental model better... ymmv) to do it in HDL.

Edit: System Generator is pretty awesome though!

hamiltonkibbe··on On FPGAs as PC Coprocessors (1996)
Both Xilinx and Altera are using ARM AXI protocol for the FPGA-CPU interface in their current SoCs.
hamiltonkibbe··on 24/192 music downloads make no sense
The signal you describe in your comment is very much NOT an A. look at the fourier transform of a 1kHz signal modulated by a 440Hz signal, and you won't see any frequency component at 440Hz, nor any integer multiple 440Hz!

You can look at your "A440 at a constant volume" example as a 0Hz(DC) signal getting louder and softer 440 times a second, but this is the only case in which your example holds. Amplitude modulation creates sum and difference frequencies, so the A that you hear is 440Hz + 0Hz. if you change that 0Hz to 1kHz, you get a signal thats the sum of a sinewave at 560Hz and a sinewave at 1.44kHz, neither of which are an A.

The distinction is that the 1Hz signal is modulating the audible signal, not adding to it, if you look at the spectrum of the sum of those frequencies there is no 1Hz component, whereas if you added a 1Hz signal you'd get something completely different. And in this case the amplitude of the signal is always changing faster than 1Hz.

Edit: another way of looking at it: You wouldn't say you can "hear DC" because you can hear an A440 played at a perfectly constant volume.

hamiltonkibbe··on 24/192 music downloads make no sense
Yes, but obviously they don't work if your signal is already aliased. The most common example would be when decimating a signal, e.g using a digital filter with a cutoff at 22khz before down sampling from 192kHz to 44.1kHz. This is often realized in a single step... Check out polyphase interpolation/decimation if you're interested in learning more
← PreviousPage 3 of 8Next →