Skip to content

Commit 43fe4a7

Browse files
committed
Revert "remove duplicates (#421)"
This reverts commit 8331c34.
1 parent b8b043f commit 43fe4a7

8 files changed

Lines changed: 534 additions & 0 deletions

File tree

add_front_matter.py

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import os
2+
import re
3+
4+
# Define the root directory for the docs folder
5+
root_dir = "./docs"
6+
7+
# Template for front matter
8+
front_matter_template = """---
9+
id: {id}
10+
title: "{title}"
11+
description: "{description}"
12+
---
13+
"""
14+
15+
# Function to clean up the file name (remove leading numbers and hyphens)
16+
def clean_file_name(file_name):
17+
base_name = os.path.splitext(file_name)[0]
18+
cleaned_name = re.sub(r"^\d+", "", base_name) # Remove leading numbers
19+
cleaned_name = cleaned_name.lstrip("-").replace("-", " ") # Remove leading hyphens and replace hyphens with spaces
20+
return cleaned_name.capitalize(), cleaned_name
21+
22+
# Function to generate front matter for a file
23+
def generate_front_matter(file_name, folder_name):
24+
title, id_name = clean_file_name(file_name)
25+
unique_id = f"{folder_name}-{id_name}" # Prefix folder name to ensure uniqueness
26+
description = f"{title} page in {folder_name.replace('-', ' ').capitalize()} of CircuitVerse documentation."
27+
return front_matter_template.format(id=unique_id, title=title, description=description)
28+
29+
# Function to overwrite front matter in a file
30+
def overwrite_front_matter_in_file(file_path, folder_name):
31+
print(f"Processing file: {file_path}") # Debug: Log the file being processed
32+
try:
33+
with open(file_path, "r") as file:
34+
content = file.read()
35+
36+
# Extract the content after existing front matter
37+
if content.strip().startswith("---"):
38+
# Find the closing `---` of the existing front matter
39+
content_after_front_matter = content.split("---", 2)[2].strip()
40+
else:
41+
content_after_front_matter = content.strip()
42+
43+
# Generate new front matter
44+
file_name = os.path.basename(file_path)
45+
front_matter = generate_front_matter(file_name, folder_name)
46+
new_content = front_matter + "\n\n" + content_after_front_matter
47+
48+
print(f"Generated new front matter: \n{front_matter}") # Debug: Show new front matter
49+
50+
# Write the updated content back to the file
51+
with open(file_path, "w") as file:
52+
file.write(new_content)
53+
print(f"Updated front matter for: {file_path}") # Debug: Confirm success
54+
except Exception as e:
55+
print(f"Error processing file {file_path}: {e}")
56+
57+
# Walk through all .mdx files in the directory and subdirectories
58+
def process_all_mdx_files(root_directory):
59+
for subdir, _, files in os.walk(root_directory):
60+
folder_name = os.path.basename(subdir) # Get the folder name (e.g., chapter1)
61+
for file in files:
62+
if file.endswith(".mdx"):
63+
file_path = os.path.join(subdir, file)
64+
overwrite_front_matter_in_file(file_path, folder_name)
65+
66+
if __name__ == "__main__":
67+
print(f"Starting front matter overwrite for all .mdx files in {root_dir}...\n")
68+
process_all_mdx_files(root_dir)
69+
print("\nFront matter overwrite complete!")
70+

docs/chapter7/1cvdesignprocess.mdx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
id: chapter7-cvdesignprocess
3+
title: "Cvdesignprocess"
4+
description: "Cvdesignprocess page in Chapter7 of CircuitVerse documentation."
5+
---
6+
7+
# Understanding CircuitVerse Design Process
8+
9+
CircuitVerse simulator allows users to build and simulate their designs on the go. Users can build a circuit by dragging elements from the **CIRCUIT ELEMENTS** panel and setting the relevant properties for each element using the **PROPERTIES** panel. Different circuit elements can then be connected by clicking on the output of one gate or port, and dragging the mouse to the input of the next one. While nesting circuits within one another, the circuit layout must be edited before inserting the subcircuit. If required, the **Combinational Analysis** tool can also be used to simulate the behavior of a functional design using truth tables and Boolean expressions.
10+
11+
Finally, the circuit schematic must be annotated using the different annotation elements available in the **PROPERTIES** panel. Any questions or suggestions can be shared with the CircuitVerse Forum where CircuitVerse mentors and a growing community of users can answer your queries or share quick workarounds.
12+
13+
For best practices of building circuits within CircuitVerse, [refer this section](/chapter2/4bestpracticescv.md).

docs/chapter7/2buildwithcv.mdx

Lines changed: 262 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,262 @@
1+
---
2+
id: chapter7-buildwithcv
3+
title: "Buildwithcv"
4+
description: "Buildwithcv page in Chapter7 of CircuitVerse documentation."
5+
---
6+
7+
# Building Circuit Simulations within CircuitVerse
8+
9+
In this section, we will build a circuit of a full adder exploring the different stages of building a live circuit within the CircuitVerse simulator. We will start off by creating a circuit of a half adder and insert it as a subcircuit to create a 4-bit full adder.
10+
11+
- [Building Circuit Simulations within CircuitVerse](#building-circuit-simulations-within-circuitverse)
12+
- [Create and Save New Project](#create-and-save-new-project)
13+
- [Create Circuit Using CircuitVerse Simulation](#create-circuit-using-circuitverse-simulation)
14+
- [Edit Circuit Layout](#edit-circuit-layout)
15+
- [Insert Subcircuit](#insert-subcircuit)
16+
- [a. Insert Subcircuit as a CircuitVerse Simulation](#a-insert-subcircuit-as-a-circuitverse-simulation)
17+
- [b. Insert Circuit Using Verilog Module](#b-insert-circuit-using-verilog-module)
18+
- [Annotate Circuit](#annotate-circuit)
19+
20+
## Create and Save New Project
21+
22+
Although the CircuitVerse simulator saves the circuit periodically and any unsaved circuits may be recovered from the browsers memory, the user must create an account and save the CircuitVerse project online for future reference.
23+
24+
Follow the below steps to create a new project and save the circuit online:
25+
26+
1. Navigate to [https://circuitverse.org/](https://circuitverse.org/).
27+
28+
2. Click on the **Launch Simulator** button to launch the simulator. Refer Figure 7.1.
29+
30+
![drawing](/img/img_chapter7/7.1.png)
31+
32+
<div align="center">
33+
<em>Figure 7.1</em>
34+
</div>
35+
36+
3. Navigate to the **Quick Access Panel**. Click on either **Save Online** icon or **Save Offline** icon to receive the** Enter Project Name**: pop-up window for saving the circuit. Refer Figure 7.2.
37+
38+
> NOTE: If a project file is saved online, it is available on the dashboard. Alternatively, any project file that is saved offline, is downloaded to your browser’s local storage.
39+
40+
![drawing](/img/img_chapter7/7.2.png)
41+
42+
<div align="center">
43+
<em>Figure 7.2</em>
44+
</div>
45+
46+
4. If the project is saved online, you will be directed to the **Edit Project** details page for sharing more information about the project (refer Figure 7.3).
47+
48+
![drawing](/img/img_chapter7/7.3.png)
49+
50+
<div align="center">
51+
<em>Figure 7.3</em>
52+
</div>
53+
54+
Watch this video for more information on the different fields that can be used for sharing more information about the project.
55+
56+
<div>
57+
<iframe>insert saving project video link</iframe>
58+
</div>
59+
.
60+
61+
5. Click **Update Project** to save the project details and return back to the CV simulator window. Refer Figure 7.4.
62+
63+
![drawing](/img/img_chapter7/7.4.png)
64+
65+
<div align="center">
66+
<em>Figure 7.4</em>
67+
</div>
68+
69+
## Create Circuit Using CircuitVerse Simulation
70+
71+
After successfully creating a CircuitVerse user account, follow the below steps for creating a circuit of a half adder within the CircuitVerse simulator:
72+
73+
6. Navigate to the **CIRCUITS ELEMENTS** panel. Identify the relevant circuit elements and drop them on the canvas. If required, you may search for an element in the search bar. Refer Figure 7.5.
74+
75+
![drawing](/img/img_chapter7/7.5.png)
76+
77+
<div align="center">
78+
<em>Figure 7.5</em>
79+
</div>
80+
81+
7. Connect the circuit elements by clicking on one node and dragging the mouse to the other node. Refer to Figure 7.6 for the final circuit connection.
82+
83+
> TIP: Hold down Ctrl key. Click on a node and simply move the cursor to the final node to which it needs to be attached. Clicking on the wire will insert a node at that position. Upon reaching the final node, leave the Ctrl key and click on the node to end the wire.
84+
85+
![drawing](/img/img_chapter7/7.6.png)
86+
87+
<div align="center">
88+
<em>Figure 7.6</em>
89+
</div>
90+
91+
8. Select a circuit element. It will be highlighted in yellow as shown in Figure 7.7.
92+
93+
9. Navigate to the **PROPERTIES** panel. Edit the **Label** parameter to add a label for the selected circuit element. Refer Figure 7.7.
94+
95+
![drawing](/img/img_chapter7/7.7.png)
96+
97+
<div align="center">
98+
<em>Figure 7.7</em>
99+
</div>
100+
101+
10. Repeat steps 3 and 4 to add labels for the remaining circuit elements as shown in Figure 7.7.
102+
103+
## Edit Circuit Layout
104+
105+
Before inserting a circuit as a subcircuit, the circuit layout must be edited to prevent any loss of wiring connections across different nodes or ports in the integrated circuit schematic may be lost.
106+
107+
Follow the below steps to view and edit the circuit layout of the half-adder circuit:
108+
109+
11. Navigate to the **PROPERTIES** panel.
110+
111+
12. Click on the **Edit Layout** button to display the circuit layout for the built circuit (refer Figure 7.8).
112+
113+
![drawing](/img/img_chapter7/7.8.png)
114+
115+
<div align="center">
116+
<em>Figure 7.8</em>
117+
</div>
118+
119+
13. The **Edit Layout** screen displays the page as shown in Figure 7.9. The circuit is placed inside a back box. The **LAYOUT** panel displays different options for editing the layout of the circuit.
120+
121+
![drawing](/img/img_chapter7/7.9.png)
122+
123+
<div align="center">
124+
<em>Figure 7.9</em>
125+
</div>
126+
127+
14. Change the desired settings of the **LAYOUT** panel.
128+
129+
15. Click **Save** to save the layout settings as shown in Figure 7.10.
130+
131+
![drawing](/img/img_chapter7/7.10.png)
132+
133+
<div align="center">
134+
<em>Figure 7.10</em>
135+
</div>
136+
137+
## Insert Subcircuit
138+
139+
Subcircuits can be nested across other circuit tabs as a CV simulation or as a Verilog module. This section lists the different steps for inserting subcircuits generated as a CV simulation or as a Verilog code.
140+
141+
### a. Insert Subcircuit as a CircuitVerse Simulation
142+
143+
Follow the below steps for building a full adder circuit using two half-adder subcircuits:
144+
145+
16. Click on the add tab icon (refer Figure 7.11) displayed in the circuit tab section. Alternatively, you may also click on **NewCircuit+** selection in the **Circuit** drop-down menu. As shown in Figure 7.11, the **Enter circuit name:** pop up window is displayed.
146+
147+
![drawing](/img/img_chapter7/7.11.png)
148+
149+
<div align="center">
150+
<em>Figure 7.11</em>
151+
</div>
152+
153+
17. Enter a circuit name in the text field as shown in Figure 7.11.
154+
155+
18. Click **OK** to save the circuit name. Refer Figure 7.12.
156+
157+
![drawing](/img/img_chapter7/7.12.png)
158+
159+
<div align="center">
160+
<em>Figure 7.12</em>
161+
</div>
162+
163+
19. Navigate to **Circuit** drop-down menu to select **Insert SubCircuit** from the drop down menu. As shown in Figure 7.13, the **Insert SubCircuit** pop up window is displayed.
164+
165+
![drawing](/img/img_chapter7/7.13.png)
166+
167+
168+
<div align="center">
169+
<em>Figure 7.13</em>
170+
</div>
171+
172+
20. Select the circuit that you wish to insert. Refer Figure 7.14.
173+
174+
![drawing](/img/img_chapter7/7.14.png)
175+
176+
177+
<div align="center">
178+
<em>Figure 7.14</em>
179+
</div>
180+
181+
21. Click the **Insert SubCircuit** button to insert the subcircuit within the **Full Adder** tab (refer Figure 7.14).
182+
183+
22. Repeat the steps from 15 to 20 to add more sub-circuits to your circuit.
184+
185+
> TIP: Duplicate any circuit by selecting the circuit (CTRL + A), copy the circuit (CTRL + C) and paste the circuit (CTRL + V) in the desired tab or another project file.
186+
187+
23. Refer to Figure 7.15 and complete the wiring connections of the full adder circuit.
188+
189+
![drawing](/img/img_chapter7/7.15.png)
190+
191+
192+
<div align="center">
193+
<em>Figure 7.15</em>
194+
</div>
195+
196+
### b. Insert Circuit Using Verilog Module
197+
198+
If required, a user can also insert a Verilog module as a subcircuit. Follow the below steps to insert a circuit layout constructed using a verilog module:
199+
200+
1. Navigate to **Circuit** drop-down menu to select **New Verilog Module** from the drop down menu. As shown in Figure 7.16, the **Enter circuit name** pop up window is displayed.
201+
202+
![drawing](/img/img_chapter7/7.16.png)
203+
204+
<div align="center">
205+
<em>Figure 7.16</em>
206+
</div>
207+
208+
2. Enter a circuit tab name in the text field. Refer Figure 7.16.
209+
210+
3. Click **OK **to launch the Verilog code interface window as shown in Figure 7.17.
211+
212+
![drawing](/img/img_chapter7/7.17.png)
213+
214+
<div align="center">
215+
<em>Figure 7.17</em>
216+
</div>
217+
218+
4. Enter the desired Verilog code in the module interface. Refer Figure 7.18.
219+
220+
![drawing](/img/img_chapter7/7.18.png)
221+
222+
<div align="center">
223+
<em>Figure 7.18</em>
224+
</div>
225+
226+
5. Click on the **Save Code** button to receive the message that the code has been saved successfully. Refer Figure 7.19.
227+
228+
![drawing](/img/img_chapter7/7.19.png)
229+
230+
<div align="center">
231+
<em>Figure 7.19</em>
232+
</div>
233+
234+
## Annotate Circuit
235+
236+
Follow the below steps to annotate the final circuit diagram:
237+
238+
24. Navigate to the **Misc** section of the **CIRCUIT ELEMENTS** panel as shown in Figure 7.20.
239+
240+
![drawing](/img/img_chapter7/7.20.png)
241+
242+
<div align="center">
243+
<em>Figure 7.20</em>
244+
</div>
245+
246+
25. Drag the **Text Tool** element on the canvas as shown in Figure 7.21.
247+
248+
![drawing](/img/img_chapter7/7.21.png)
249+
250+
<div align="center">
251+
<em>Figure 7.21</em>
252+
</div>
253+
254+
26. Navigate to the **PROPERTIES** panel to edit the **Label:** text field as shown in Figure 7.21.
255+
256+
27. Repeat steps 24 to 26 to add more annotation elements. In Figure 7.22, a **Rectangle Tool** element has been added to highlight the structural relationship across different elements .
257+
258+
![drawing](/img/img_chapter7/7.22.png)
259+
260+
<div align="center">
261+
<em>Figure 7.22</em>
262+
</div>

0 commit comments

Comments
 (0)