-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtry.cpp
More file actions
33 lines (25 loc) · 1002 Bytes
/
try.cpp
File metadata and controls
33 lines (25 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <iostream>
#include <cstdint>
// Memory-mapped address of the Zedboard's memory location
#define MEMORY_BASE_ADDRESS 0x00000000
// Size of the array
#define ARRAY_SIZE 10
int main() {
// Define the array
uint32_t array[ARRAY_SIZE] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
// Set up the communication interface with the Zedboard
// (e.g., establish a connection via Ethernet, USB, or UART)
// Transfer the array to the Zedboard's memory
uint32_t* memory_ptr = reinterpret_cast<uint32_t*>(MEMORY_BASE_ADDRESS);
for (int i = 0; i < ARRAY_SIZE; i++) {
*(memory_ptr + i) = array[i];
}
// Verify the array has been written to memory
for (int i = 0; i < ARRAY_SIZE; i++) {
uint32_t value = *(memory_ptr + i);
std::cout << "Memory address: 0x" << std::hex << (MEMORY_BASE_ADDRESS + i * sizeof(uint32_t))
<< ", Value: " << std::dec << value << std::endl;
}
// Close the communication interface
return 0;
}