-
[µblog] Generic pointers in C
Arithmetic step size of a pointer A pointer is a variable that holds an address. So, if we declare int *ptr, we are saying that ptr is a variable that holds the address of an integer. Its arithmetic step size is the size of an integer. If we increment it as in ptr++ it would…
-
[blog] Monolithic Kernel and Microkernel
Setting aside more exotic approaches, generally, two kernel models are described: monolithic and microkernel. The crucial difference between them is the amount of system resources that run in supervisor space and user space. Figure 1 conceptually illustrates the two approaches. In the microkernel a smaller set of processes run in kernel space. System programs, such as the file system,…
-
Designing and implementing IPC mechanisms on an ARM Cortex-M3 kernel (1/2)
1. INTRODUCTION I do think system programming is one of the nicest things to do: taking a computer board (I/O, CPU, Memory) and creating its system software from the scratch so it performs some work is awesome. I have presented a kernel implementation for an ARM Cortex-M3 microprocessor. So far, the features are: Just these…
-
[blog] Synchronous versus asynchronous reset on ASIC Design
Reset is about getting a system back to a known initial state. Temporary data is flushed. Everything will be put to a known state so the circuit starts up. Sounds important. When we go for synchronous or asynchronous reset, active low, our HDL code will look like one of these: To simplify, firstly, think about…
-
[blog] Essential Software Engineering
Computer Science is a branch of Mathematics. Have you ever wondered how Mathematics is a tool that can tackle a great number of different problems, on different fields relying on the very same concepts? Perhaps part of the answer is because, as Poincaré once stated: “Mathematicians do not study objects, but the relations between objects;…
-
[blog] Runtime polymorphism exploited
In this post I will be showing a dynamic polymorphism implemented in C to take a look on what C++ implements under the hood. The idea is to have an abstract class Polygon which has a public method to calculate the area of a given general polygon. In C++ the implementation is straightforward. C++ does…
-
[blog] C++ for C programmers #2
Returning user-defined types In C, suppose we want to create a function that gets the position of a certain device. We usually would have created a Position type definition, and the functions to retrieve this position would look like one of these: In function 1 the called function would allocate the memory for the Position…
-
[blog] C++ for C programmers #1
C is everywhere on system-programming because it allows high-level abstraction keeping low-overhead. The strong type system is an example. It is used at compile time to check for program correctness. After compile time the types will have disappeared and the emitted assembly code will show no trace of the type system. C++ also takes zero-overhead…
-
[blog] C variables and pointers: declarations and definitions
It might sound naive, but it is a very common interview question, and I actually think the notation can be deceiving. And furthermore, it is essential. A few months off and you will be asking yourself “how is that again?”. Unless you get this rule: start reading from right to left. Question: Please read the…
-
Low-power 3/3: microarquitetura e RTL
6 Abordagens para redução de consumo em RTL As ferramentas de síntese e back-end detectam oportunidades para salvar energia diretamente do RTL, portanto a microarquitetura e, consequentemente o estilo de codificação tem um grande impacto no consumo. A medida que o fluxo avança, menores são as intervenções que podem ser feitas para reduzir a energia…
-
[blog] O Amplificador Diferencial
Comentários básicos sobre este workhorse em eletrônica. O conceito de amplificador diferencial é elemento-chave em uma infinidade de aplicações analógicas: buffers, filtros, osciladores, reguladores de tensão, referências de tensão/corrente, processamento de sinais, PLLs, etc., devido às suas características. As figuras foram retiradas do livro CMOS Circuit, Design, Layout and Simulation (Baker). O Par diferencial O…
-
[blog] NASA’s Ten Principles of Safety-Critical Code
These are the NASAs ten principles for safety-critical code. It is interesting to note that they were published later than MISRA-C that already covers it naturally. I have never worked on safety-critical systems (never made systems which a fail could kill people), but my comments on that: Besides, to strictly achieve all 10 points, it…
-
[blog] “Silicon Cowboys”, a história da Compaq
Nesta semana assisti ao documentário (disponível no Netflix) “Silicon Cowboys” que conta a história da fundação da Compaq. A Compaq parece ser uma história de sucesso que juntou algum brilhantismo técnico com um gerenciamento todo brilhante.“Não era sobre criarmos um computador ou ficarmos ricos. Era sobre criarmos uma empresa boa para se trabalhar” disse Rod, um…