|
| 1 | +--- |
| 2 | +title: "CircuitVerse Vue Simulator: Final Report (GSoC 2024)" |
| 3 | +date: 2024-08-26T02:00:00+05:30 |
| 4 | +author: Niladri Adhikary |
| 5 | +type: post |
| 6 | +--- |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | +This blog post is the final report for the **CircuitVerse Vue Simulator** project, which was part of **Google Summer of Code 2024**. The project aimed to complete the new Vue-based simulator for CircuitVerse, a digital logic simulator. |
| 11 | + |
| 12 | +## Table of Contents |
| 13 | + |
| 14 | +{{< toc >}} |
| 15 | + |
| 16 | +### Project Goals - |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +1. Fixing existing bugs and Completing the implementation of simulator components |
| 21 | +2. Designing and implementing a better UI/UX for the mobile version |
| 22 | +3. TypeScript Transition, jQuery Elimination, Transferring all DOM manipulations |
| 23 | +4. Developing a comprehensive test suite for the Vue simulator |
| 24 | +5. Moving the CSS styles and Finishing refactoring the codebase |
| 25 | +6. Integrating stability improvements and addressing any performance issues |
| 26 | +7. Merging updates and bug fixes from the main CircuitVerse repository |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +### 🔹 Fixing existing bugs and Completing the implementation of simulator components 🔀 |
| 31 | + |
| 32 | +Fixing existing bugs and completing the implementation of remaining simulator components was the primary goal of the Task. |
| 33 | + |
| 34 | +This included conversion of the following components: |
| 35 | + |
| 36 | +1. `Layout Elements Panel` |
| 37 | +3. `TestBench Panel` |
| 38 | +4. `TestBench Creator` |
| 39 | +5. `TestBench Validator` |
| 40 | +6. `Alert Message Box` |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | +Some Bug fixes that were done: |
| 45 | + |
| 46 | +1. Fixed mini map rendering issue |
| 47 | +2. Fixed Timming Diagram Buttons not working |
| 48 | + |
| 49 | +### 🔹 Designing and implementing a better UI/UX for the mobile version 📱 |
| 50 | + |
| 51 | +The mobile version of the vue simulator was not implemented. The goal was to make the simulator responsive and mobile-friendly. |
| 52 | + |
| 53 | +Mobile components that were implemented: |
| 54 | + |
| 55 | +1. `Circuit Elements Mobile Panel` |
| 56 | +2. `Properties Mobile Panel` |
| 57 | +3. `Timing Diagram Mobile Panel` |
| 58 | +4. `Quick Buttons Mobile Panel` |
| 59 | +5. `Verilog Editor Mobile Panel` |
| 60 | +6. `Mobile Sidebar` and `User Menu` |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | +Some features that were implemented: |
| 69 | + |
| 70 | +1. Touch support for mobile |
| 71 | +2. Pinch to zoom |
| 72 | +3. Multiple Selection Button |
| 73 | +4. Copy & Paste Button |
| 74 | + |
| 75 | +### 🔹 TypeScript Transition, jQuery Elimination, Transferring all DOM manipulations 🛠 |
| 76 | + |
| 77 | +The goal was to convert the existing codebase to TypeScript and eliminate jQuery from the codebase. Also, all DOM manipulations were to be transferred to Vue. |
| 78 | + |
| 79 | +The following components were converted to TypeScript: |
| 80 | + |
| 81 | +1. `Project.ts` |
| 82 | +2. `Utils.ts` |
| 83 | +3. `Testbench.ts` |
| 84 | +4. `OpenOffline.vue` |
| 85 | +5. `plotArea.ts` |
| 86 | +6. `TimingDiagramPanel.vue` |
| 87 | +7. `app.ts` |
| 88 | +8. `arrayHelper.ts` |
| 89 | +9. `backgroundArea.ts` |
| 90 | +10. `data.ts` |
| 91 | +11. `moduleSetup.ts` |
| 92 | +12. `sequential.ts` |
| 93 | +13. `verilogHelpers.ts` |
| 94 | +14. `Circuit.ts` |
| 95 | +15. `eventQueue.ts` |
| 96 | +16. `quinMcCluskey.ts` |
| 97 | +17. `customThemeAbstraction.ts` |
| 98 | +18. `applyTheme.vue` |
| 99 | +19. `layoutMode.ts` |
| 100 | +20. `layoutNode.ts` |
| 101 | +21. `layoutBuffer.ts` |
| 102 | + |
| 103 | +Also all the DOM manipulations were transferred to respective Vue components eliminating jQuery. |
| 104 | + |
| 105 | +### 🔹 Developing a comprehensive test suite for the Vue simulator 🧪 |
| 106 | + |
| 107 | +The goal was to develop a comprehensive test suite for the Vue simulator. |
| 108 | + |
| 109 | +Implemented Test cases for the Vue simulator using |
| 110 | + |
| 111 | +- `Vitest` |
| 112 | +- `JsDOM` |
| 113 | +- `@vue/test-utils` |
| 114 | + |
| 115 | +Implementation of test cases: |
| 116 | + |
| 117 | +Created a testing environment using Vitest and JsDOM, configured in the **vite.config.ts** file. |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | +Wrote all the test cases under the **/spec** folder using Vitest and mounted the components them using **@vue/test-utils**. |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | +Created a **/testdata** folder under the spec folder for storing the testing data |
| 128 | + |
| 129 | +Created a **/circuits** folder to keep all the circuits elements data |
| 130 | + |
| 131 | +After implementing all this we can finally run our test cases using **npm run test** cmd |
| 132 | + |
| 133 | + |
| 134 | + |
| 135 | +### 🔹 Moving the CSS styles and Finishing refactoring the codebase 🎨 |
| 136 | + |
| 137 | +The goal was to move the Global CSS styles to the Vue components Scoped CSS and finish refactoring the codebase. |
| 138 | + |
| 139 | +The following Global CSS styles were moved to the Vue components: |
| 140 | + |
| 141 | +- `UX.css` |
| 142 | +- `main.stylesheet.css` |
| 143 | + |
| 144 | +### 🔹 Integrating stability improvements and addressing any performance issues 🚀 |
| 145 | + |
| 146 | +The goal was to integrate stability improvements and address any performance issues. |
| 147 | + |
| 148 | +Some of the stability improvements that were done: |
| 149 | + |
| 150 | +1. Added helpful functions for debugging of circuit |
| 151 | +2. Moving a component mess up the connected wires |
| 152 | +3. Implemented state machine for simulator |
| 153 | +4. Change the implementation of the priority queue to use a heap data structure |
| 154 | + |
| 155 | +### 🔹 Merging updates and bug fixes from the main CircuitVerse repository 🔄 |
| 156 | + |
| 157 | +The goal was to merge updates and bug fixes from the main CircuitVerse repository. |
| 158 | + |
| 159 | +- Advance Options for embed view implemented |
| 160 | + |
| 161 | +The embedded view of CircuitVerse circuits can be used to display circuits in an iframe on other websites. |
| 162 | + |
| 163 | + |
| 164 | + |
| 165 | +By clicking the Embed button on the bottom right, a dialog box can be opened, allowing the user to create a customised embed view for the circuit. |
| 166 | + |
| 167 | +- Since decoupling of the new vue simulator some updates and bug fixes were made in the main simulator that were merged to the new Vue simulator. |
| 168 | + |
| 169 | +### 🔹 Future Work 📅 |
| 170 | + |
| 171 | +- Finishing up the typescript integration. |
| 172 | +- Creating the desktop application. |
| 173 | + |
| 174 | +### 🔹 Pull Requests 📥 |
| 175 | + |
| 176 | +**Some of the major PRs that were created during the project period:** |
| 177 | + |
| 178 | +- [Advance options for embed view](https://github.com/CircuitVerse/cv-frontend-vue/pull/312) |
| 179 | +- [Timing Diagram increase decrease buttons](https://github.com/CircuitVerse/cv-frontend-vue/pull/313) |
| 180 | +- [Implemented LayoutElements Panel vue component](https://github.com/CircuitVerse/cv-frontend-vue/pull/317) |
| 181 | +- [TestBench (Creator, Panel, Validator, DialogBox) Vue Component Implemented](https://github.com/CircuitVerse/cv-frontend-vue/pull/323) |
| 182 | +- [Mobile view Implementation for vue simulator](https://github.com/CircuitVerse/cv-frontend-vue/pull/361) |
| 183 | +- [Global styles moved to component scoped styles](https://github.com/CircuitVerse/cv-frontend-vue/pull/365) |
| 184 | +- [Testcases for vue simulator [Vitest]](https://github.com/CircuitVerse/cv-frontend-vue/pull/364) |
| 185 | +- [ts + vue integration and jquery removal in layout files](https://github.com/CircuitVerse/cv-frontend-vue/pull/341) |
| 186 | +- [ts integration, jquery migration to vue's reactives for plotArea and Timing Diagram panel](https://github.com/CircuitVerse/cv-frontend-vue/pull/329) |
| 187 | +- [Added helpful functions for debugging of circuit](https://github.com/CircuitVerse/cv-frontend-vue/pull/366) |
| 188 | +- [Moving a component mess up the connected wires](https://github.com/CircuitVerse/cv-frontend-vue/pull/367) |
| 189 | +- [Implemented state machine for simulator](https://github.com/CircuitVerse/cv-frontend-vue/pull/368) |
| 190 | +- [Change the implementation of the priority queue to use a heap data structure](https://github.com/CircuitVerse/cv-frontend-vue/pull/369) |
| 191 | + |
| 192 | +### 🔹 blogs 📝 |
| 193 | + |
| 194 | +[**Phase 1 blog GSoC@24 Niladri Adhikary**](https://blog.circuitverse.org/posts/niladri_phase_1_report/) |
| 195 | + |
| 196 | +- `week 0` - [GSoC@24 - Community Bonding](https://dev.to/niladri_adhikary_f11402dc/gsoc24circuitverse-week-0-community-bonding-1pni) |
| 197 | +- `week 1 & 2` - [GSoC@24 - week 1&2 blog](https://dev.to/niladri_adhikary_f11402dc/gsoc24circuitverse-week-1-2-37gj) |
| 198 | +- `week 3 & 4` - [GSoC@24 - week 3&4 blog](https://dev.to/niladri_adhikary_f11402dc/gsoc24circuitverse-week-3-4-21fg) |
| 199 | +- `week 5 & 6` - [GSoC@24 - week 5&6 blog](https://dev.to/niladri_adhikary_f11402dc/gsoc24circuitverse-week-5-6-44hd) |
| 200 | +- `week 7 & 8` - [GSoC@24 - week 7&8 blog](https://dev.to/niladri_adhikary_f11402dc/gsoc24circuitverse-week-7-8-33ig) |
| 201 | +- `week 9 & 10` - [GSoC@24 - week 9&10 blog](https://dev.to/niladri_adhikary_f11402dc/gsoc24circuitverse-week-9-10-45me) |
| 202 | +- `week 11 & 12` - [GSoC@24 - week 11&12 blog](https://dev.to/niladri_adhikary_f11402dc/gsoc24circuitverse-week-11-12-2p4h) |
| 203 | + |
| 204 | +### 🔹 Conclusion ✅ |
| 205 | + |
| 206 | +The project was successfully completed and all the goals were achieved. The new Vue simulator is now ready to be integrated into the main CircuitVerse repository. The project was a great learning experience and I would like to thank my mentors for their guidance and support throughout the project. I would also like to thank Google for giving me this opportunity to work on such an amazing project. |
0 commit comments