Questions tagged [optimization]
108 questions
21
votes
6 answers
LTspice automation
I have a battery-powered boost converter and I'm attempting to measure the maximum input (battery) voltage droop under various load conditions of high current draws (different duty-cycles/periodicities) in addition to over several battery types…

Joel B
- 3,477
- 2
- 29
- 37
16
votes
2 answers
Why is this Verilog RAM modification better in terms of resource usage?
I'm using the open-source toolchain Yosys > NextPnr > IcePack for synthesising code for the Lattice HX8K FPGA. Here's a common version of a 1Kb RAM (that I'm using as Video RAM for a VGA module):
module text_ram #(
parameter A = 10,
…

Hugo Sereno Ferreira
- 554
- 1
- 3
- 20
15
votes
12 answers
Is it really a good-practice disable optimizations during the development and debugging phases?
I've read Programming 16-Bit PIC Microcontrollers in C, and there is this affirmation in the book:
During the development and debugging
phases of a project, though, it is
always good practice to disable all
optimizations as they might modify…

Daniel Grillo
- 7,659
- 18
- 51
- 69
15
votes
2 answers
How can I specify "don't care" signals in VHDL?
In Logic Design courses we all learned that it is possible to minimize a logic function, for example by using a Karnaugh map or the Quine–McCluskey algorithm. We also learned that "Don't Care" values increase the minimization potential.
For example…

Fritz
- 768
- 1
- 5
- 17
13
votes
6 answers
Tips for optimizing through-hole soldering
I make and sell low voltage, mostly digital, retrocomputing expansion boards as a hobby/hustle. I use all through-hole components partly because of the retro aesthetic and partly because I find soldering through-hole relaxing and fun to do.
I'm…

Sam Washburn
- 503
- 4
- 16
13
votes
10 answers
Fastest way to get integer mod 10 and integer divide 10?
If a hardware doesn't support modulus or division operations, it takes many more CPU cycles to simulate modulus/division by software. Is there any faster way to calculate division and modulus if the operand is 10?
In my project I frequently need to…

Donotalo
- 347
- 1
- 3
- 7
12
votes
3 answers
How to identify areas of a FPGA design that use the most resources and area?
I am working on a large FPGA design, and I am very close to the resource limits of the FPGA that I am currently using, the Xilinx LX16 in the CSG225 package.
The design is also almost complete, however at the moment it will no longer fit in the…

Marcus10110
- 589
- 3
- 13
10
votes
7 answers
Simplifying many window comparators
I have 8 thermistors and I must make sure that each of them is inside a temperature window. They all have the same window and I don't care which or how many are inside the valid range, I just need to know if all of them are inside the (same) window…

ultimA
- 440
- 4
- 11
9
votes
2 answers
Reduce the size of the Arduino bootloader?
Is there any way of reducing the size of the preloaded Arduino bootloader, to save some bytes for the program?

powtac
- 1,022
- 2
- 16
- 27
9
votes
1 answer
While loop optimized away
I have the following code in my microcontroler program:
// Wait for ADC conversion to complete
while ( ( ADCSRA && _BS( ADSC ) ) == _BS( ADSC ) ) {}
Where ADCSRA is a register that will change its value once an analog conversion is completed and…

jippie
- 33,033
- 16
- 93
- 160
9
votes
4 answers
Why GCC compiler omitting some code?
I can not understand why GCC compiler cutting out part of my code while it preserve absolutely the same one in the neighborhood?
The C code:
#define setb_SYNCO do{(PORTA|= (1<<0));} while(0);
ISR(INT0_vect){
unsigned char i;
i = 10;
…

Roman Matveev
- 2,942
- 7
- 32
- 75
9
votes
2 answers
Under what conditions does an optocoupler work fastest?
I want to use the optocoupler FODM452R2 in my design. I want this optocoupler to run as fast as it can (i.e.; work with minimum propagation delay and least rise/fall times). What is the optimum R1, R2 resistor values and magnitudes of V1, V2…

hkBattousai
- 13,913
- 31
- 114
- 190
8
votes
3 answers
SPI chip select optimisation
I am designing an SPI system with one master and two slaves. In a normal SPI system, the master needs 2 outputs to control the slaves' chip select lines. I want to use only one output to drive both chip selects thanks to a classic NOT gate.…

M.Ferru
- 3,926
- 3
- 22
- 48
7
votes
2 answers
AVR assembly: fastest way to increment two combined bytes
What is the fastest way to increment two combined bytes in assembler (assuming I'm working on an 8-bit CPU)? Currently I'm doing this:
OVF1_handler: ; TIMER1 overflow ISR
lds r21, timerhl ; load low byte into working register; 2 cycles
add r21,…

arminb
- 1,622
- 4
- 21
- 34
7
votes
2 answers
Electromagnet design
Im trying to design a maximum strength electromagnet. I have a soft iron core that is 1.3" (33mm) round by 1.9" (50mm) long and I'm using 12 volts of input and my wire gauge is 18awg. Unfortunately I don't have the proper program to achieve this…

Warren
- 81
- 3