This project implements the Bitonic Sort algorithm in ARM Assembly language, designed to simulate multicore parallel processing on a Cortex-M3 processor. The implementation divides the sorting workload across four simulated cores, demonstrating how parallel algorithms can improve sorting efficiency.
- Course: CS 2400-003
- Semester: Fall 2025
- Institution: Metroploitan State University of Denver
- Isaiah Fite
- Matt Cantin
- Jackson Thomas
Bitonic sort is a parallel sorting algorithm that works by recursively constructing a bitonic sequence (a sequence that monotonically increases then decreases, or vice versa) and then merging it into a sorted sequence. It is particularly well-suited for parallel execution because comparisons can be performed independently.
Key Properties:
- Time Complexity: O(log²n) parallel time with n processors
- Data Size: Works best with power-of-2 sized arrays
The algorithm simulates four cores working in parallel:
- Core 0: Sorts the first quarter (ascending)
- Core 1: Sorts the second quarter (descending) and merges the first half
- Core 2: Sorts the third quarter (ascending)
- Core 3: Sorts the fourth quarter (descending), merges the second half, and performs final merge
- Target: ARM Cortex-M3
- Language: ARM Assembly (ARMv7-M instruction set)
- Simulator: Keil µVision 5
Entry point that initializes direction control and calls all four cores sequentially (simulating parallel execution).
Individual core routines that:
- Initialize their segment of the array
- Sort their quarter using
bitonicSort - Perform necessary merge operations
Recursive function that:
- Splits array segment in half
- Sorts first half in one direction
- Sorts second half in opposite direction
- Merges the bitonic sequence
Recursively merges a bitonic sequence by:
- Comparing and swapping elements at distance n/2
- Recursively merging both halves
- r4: Array base address
- r5: Current segment length
- r6: Direction flag (1 = ascending, 0 = descending)
- r7-r8: Temporary calculation registers
- r9: Debug register (holds final array address)
- Keil µVision IDE (version 5 or later recommended)
- ARM Cortex-M3 device pack installed
-
Clone the repository:
git clone https://github.com/IsaiahFite/CS2400Group6.git cd CS2400Group6 -
Open Keil µVision
-
Create a new project or open existing project file
- Device Selection: Select an ARM Cortex-M3 device (e.g., STM32F103)
- Manage Runtime Environment Select CMSIS->CORE and Device->C startup
-
Debug Select Simulation
-
Linker Select Scatter File
-
Add
main.sto your project
-
Build the Project:
- Click Project → Build Target (F7)
- Verify no errors in the build output
-
Start Debug Session:
- Click Debug → Start/Stop Debug Session (Ctrl+F5)
-
Run the Simulation:
- Click Debug → Run (F5)
- The program will execute until the
stoplabel
-
View Results:
- Open Memory Window (View → Memory Windows → Memory 1)
- Enter the address of
arrto see the sorted array - Or view register
r9which holds the array address after execution
- Batcher, K. E. (1968). "Sorting networks and their applications"
- ARM Cortex-M3 Technical Reference Manual
- ARM Assembly Language Programming (ARMv7-M)
For questions or issues, please contact the team members or create an issue in the repository.
Last Updated: November 18, 2025