https://github.com/rusyaev-dk/microcircuit_optimization
Optimized stack-based exponentiation for efficient RSA computation. Implements a microcircuit model with minimal clock cycles using binary exponentiation and greedy decomposition.
https://github.com/rusyaev-dk/microcircuit_optimization
binary-exponentiation cpp graphics microcircuit optimization-problem research stack xlsx
Last synced: 10 months ago
JSON representation
Optimized stack-based exponentiation for efficient RSA computation. Implements a microcircuit model with minimal clock cycles using binary exponentiation and greedy decomposition.
- Host: GitHub
- URL: https://github.com/rusyaev-dk/microcircuit_optimization
- Owner: rusyaev-dk
- Created: 2024-10-03T15:50:28.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-16T07:41:59.000Z (10 months ago)
- Last Synced: 2025-02-16T08:21:31.057Z (10 months ago)
- Topics: binary-exponentiation, cpp, graphics, microcircuit, optimization-problem, research, stack, xlsx
- Language: C++
- Homepage:
- Size: 7.67 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Microcircuit Optimization
## π Project Description
This project focuses on optimizing computations in a stack-based microcircuit, which performs multiplication, exponentiation, and value storage operations. The main goal is to minimize the number of clock cycles required to compute the power function x^n.
## π§ Core Microcircuit Operations
Operation Description Execution Time (Cycles)
- WRITE X: Pushes the number X onto the stack 1 cycle
- MUL: Multiplies the top two numbers on the stack and replaces them with the result 1 cycle
- POW N: Raises the top value on the stack to the power of N and replaces it N - 1 cycles
## π Optimization Approach
### 1οΈβ£ Efficient Exponentiation Using Binary Exponentiation
- Instead of naΓ―ve exponentiation (O(n) complexity), the microcircuit uses binary exponentiation (O(log n)), reducing execution cycles significantly.
- Converts n into binary form.
- Uses squaring and selective multiplication to minimize operations.
### 2οΈβ£ Optimized Stack Management
- Avoids unnecessary operations and stack manipulations.
- Reduces memory footprint by efficiently handling intermediate values.
Results:


## π Performance Metrics Tracking
To measure and compare different optimization approaches, the following metrics are tracked:
- Cycles The total number of execution cycles
- Elementary Operations Number of multiplications, additions, etc.
- Execution Time (ms) The actual runtime of the computation
- These metrics help in evaluating Brute Force vs. Binary Exponentiation approaches.
## Performance Comparison
| Test Case | BF (Cycles) | BE (Cycles) | BF (Ops) | BE (Ops) | BF (ms) | BE (ms) |
|-----------|------------|------------|------------|------------|------------|------------|
| 1 | 10 | 4 | 9 | 3 | 15.432 | 7.120 |
| 2 | 20 | 5 | 18 | 4 | 32.845 | 9.302 |
Results clearly show that Binary Exponentiation (BE) is significantly more efficient than Brute Force (BF) in terms of cycles and execution time.