Instruction Set Architecture (ISA) Design

Thread Starter

MTech1

Joined Feb 15, 2023
181
I need general guidance on determining the instruction set requirements based on the applications that a simple microcontroller is capable of performing, such as controlling LEDs, reading button inputs, interfacing with digital sensors (e.g., temperature, proximity), and managing UART communication. I understand some instructions are essential for efficiently performing these operations—such as load/store, arithmetic, logical comparisons, and I/O handling.

I want to understand how do we determine the instruction set requirements based on these expected operations. how many instructions would be needed to efficiently perform these tasks, Can you explain with example
 

Ian0

Joined Aug 7, 2020
13,112
There's a difference between instruction set and peripherals.
Look at a PIC16C54 to see how small an instruction set you can get away with.
To manage UART communication, you might need a UART, but you could write a software UART, but bear in mind that something with an instruction set as small as a PIC16C54 won't be able to do much else, if it is busy being a software UART.
 

Ian0

Joined Aug 7, 2020
13,112
If you imagine a processor where the ALU is a memory-mapped peripheral, so that writing to the input registers, produces A-B, A+B, A&B, A|B, ~A, ~B, A<<1, A>>1 in a series of output registers, and the program counter was a read/write register like it is on an ARM, then the only instruction you would need is MOVcc (where cc is a condition code, which includes ALWAYS.
 

Thread Starter

MTech1

Joined Feb 15, 2023
181
There's a difference between instruction set and peripherals.
Look at a PIC16C54 to see how small an instruction set you can get away with.
To manage UART communication, you might need a UART, but you could write a software UART, but bear in mind that something with an instruction set as small as a PIC16C54 won't be able to do much else, if it is busy being a software UART.
Thank you for pointing out the distinction between the instruction set and peripherals. I understand that peripherals like UART can either be handled through hardware or implemented via software (e.g., a software UART),

From my understanding, an instruction set comprises a series of opcodes and operands that define how a microcontroller manipulates data and communicates with peripherals. I'm interested in how we can determine the necessary instructions and operands that enable basic tasks like controlling LEDs, reading button inputs, interfacing with sensors.
 

Thread Starter

MTech1

Joined Feb 15, 2023
181
In a 3-address machine you only need a SUB (subtract) instruction.

One-instruction set computer - Wikipedia
I’m curious how we would extend that concept to a set of instructions that efficiently handles tasks like I/O operations, interfacing with digital sensors, and managing UART communication. How do you typically determine the number and types of instructions needed for such applications, considering operand use in practical tasks?
 

Thread Starter

MTech1

Joined Feb 15, 2023
181
One way to look at it: how many instructions would you need to implement a Turing Complete language?
my understanding, an instruction set's opcodes and operands directly affect how efficiently a microcontroller performs specific tasks.

In microcontroller applications like LED control, sensor interfacing, and UART communication, how would you suggest determining the minimal instructions and operands needed to carry out these operations efficiently? Could you perhaps give an example showing the opcodes and operands involved
 

joeyd999

Joined Jun 6, 2011
6,246
my understanding, an instruction set's opcodes and operands directly affect how efficiently a microcontroller performs specific tasks.

In microcontroller applications like LED control, sensor interfacing, and UART communication, how would you suggest determining the minimal instructions and operands needed to carry out these operations efficiently? Could you perhaps give an example showing the opcodes and operands involved
You first have to define what you mean by "efficiency".
 

BobTPH

Joined Jun 5, 2013
11,482
From a practical viewpoint, need:

add, subtract
and, or, xor, complement
conditional and unconditional branches

But you also need to specify how operands and results are specified

Conceptually, the simplest architecture would have both operands and the result encoded in the instruction (3 address architecture).

Each operand could be a memory address or constant (literal) or indirect through an address.

But that architecture is very expensive in terms of instruction size.

A stack machine architecture is more compact.

A register architecture is in between.

There are so many possibilities it is hard to say what is “best”.

The PDP-11 is a good example of an elegant 2-address architecture (result is same as second operand). The core instruction set has only 8 operations, 8 addressing modes, and 8 registers.
 
Last edited:

nsaspook

Joined Aug 27, 2009
16,270
my understanding, an instruction set's opcodes and operands directly affect how efficiently a microcontroller performs specific tasks.

In microcontroller applications like LED control, sensor interfacing, and UART communication, how would you suggest determining the minimal instructions and operands needed to carry out these operations efficiently? Could you perhaps give an example showing the opcodes and operands involved
The most efficient microcontroller might not use many instructions for specific tasks. Many advanced controllers have dedicated hardware to handle the I/O and some of the processing for things like LED control, sensor interfacing, and UART communication. This leaves the processor to the the logical and mathematical part of the task instead of being bogged down in low-level bit-banging.
https://forum.allaboutcircuits.com/...s-with-controlling-an-led.199346/post-1893329
 
Top