General > General Technical Chat
Understanding on Terminologies
CatalinaWOW:
You seem to have gotten the concept generally right.
The specific meaning will depend on context and time.
Take module for example. Once upon a time the US military though to reduce inventory and logistics problem through implementation of standard electronic modules which they cleverly called SEMs. These were incredible simple and might include a single flip flop of a high power PNP-NPN transistor pair.
To the designer of urban transportation systems an automobile, a cloverleaf highway intersection, a bridge, a light rail system and an airport might all be considered modules.
sadasivamASK:
Yeah @Catelina. Now, its understandable. Thanks for sharing examples.
niconiconi:
Speaking of inline assembly (i.e. mixing assembly code in the middle of a high-level language like C), in my experience the common use cases are:
1. Performance-critical Code. If 90% of your CPU time is spent on an algorithm that must be as fast as possible, it makes sense to rewrite it (or at least the critical inner loop) in assembly. Example: encryption/decryption, compression/decompression, encoding/decoding for images and videos. I have first-hand experience about how cryptography programmers go to great lengths at removing even the last possible CPU cycle from the code, often with extremely convoluted techniques (for starter, https://cryptojedi.org/peter/teaching/ce2020/multiprecision.pdf for example).
2. Code with predictable timings, especially when programming small microcontrollers. For example, when bit-banging GPIO ports or handling interrupt requests, sometimes the operation must be completed within a few microseconds, or, exactly n microseconds. In high-level languages it's often not guaranteed, but in raw assembly you know exactly how many CPU cycles is spent on each instructions (though the situation is much more complicated on modern pipelined, out-of-order CPUs).
3. Directly accessing CPU instructions and registers not available in the high-level language. When you need to call a special instruction or access a register specific to a processor, sometimes it's only possible in assembly (other times, the C compiler has extensions or "Intrinsic Functions", allowing you to access them in C, but even then, assembly is sometimes still more comfortable to work with).
Navigation
[0] Message Index
[*] Previous page
Go to full version