-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Anestis Athanasiadis <[email protected]> Co-authored-by: Juan Sapriza <[email protected]>
- Loading branch information
1 parent
322f466
commit 66c3084
Showing
36 changed files
with
502 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
extern "C" { | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
} | ||
|
||
#include "MyClass.hpp" | ||
|
||
MyClass::MyClass(int initialValue) : value(initialValue) {} | ||
|
||
void MyClass::setValue(int newValue) { | ||
value = newValue; | ||
} | ||
|
||
int MyClass::getValue() { | ||
return value*5; | ||
} | ||
|
||
void MyClass::printValue() { | ||
printf("Value: %d\n\r", value); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#ifndef MYCLASS_HPP | ||
#define MYCLASS_HPP | ||
|
||
class MyClass { | ||
public: | ||
MyClass(int initialValue); // Constructor | ||
void setValue(int newValue); // Setter | ||
int getValue(); // Getter | ||
void printValue(); // Method to print the value | ||
|
||
private: | ||
int value; | ||
}; | ||
|
||
#endif // MYCLASS_HPP |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright 2024 EPFL | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* Author: Juan Sapriza <[email protected]> | ||
*/ | ||
|
||
|
||
|
||
extern "C" { | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
} | ||
|
||
#include "MyClass.hpp" | ||
#include "core_v_mini_mcu.h" | ||
#include "x-heep.h" | ||
|
||
#if TARGET_SIM && PRINTF_IN_SIM | ||
#define PRINTF(fmt, ...) printf(fmt, ##__VA_ARGS__) | ||
#elif PRINTF_IN_FPGA && !TARGET_SIM | ||
#define PRINTF(fmt, ...) printf(fmt, ##__VA_ARGS__) | ||
#else | ||
#define PRINTF(...) | ||
#endif | ||
|
||
int main() | ||
{ | ||
MyClass myObject(10); // Create an object with initial value 10 | ||
myObject.printValue(); // Print the initial value | ||
|
||
myObject.setValue(20); // Change the value to 20 | ||
myObject.printValue(); // Print the updated value | ||
|
||
int value = myObject.getValue(); // Get the value | ||
PRINTF("Retrieved Value: %d\n\r" ,value); // Print the retrieved value | ||
|
||
return value == 20*5 ? EXIT_SUCCESS : EXIT_FAILURE; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.