Electronics Simulations #5| Creating sub-circuits and how to implemen them in SimulIDE (with 4-to-1 mux example)

in utopian-io •  7 years ago  (edited)

What Will I Learn?

In this tutorial, reader:

  • will learn how to construct 4-to-1 mux in SimulIDE software
  • how to construct sub-circuits in the software
  • how to encode the sub-circuit in the software

customLogo.png

Requirements

To complete the tutorial, readers would have:

  • basic knowledge about digital circuits
  • basic knowledge about SimulIDE software
  • basic knowledge about coding

Difficulty

  • Intermediate

Tutorial Contents

In this tutorial, I am going to show how to construct sub-circuits and save them to SimulIDE software to use them later by using a 4-to-1 mux digital circuit. I will start with designing circuit, and then explain how to create sub-circuit in the software step-by-step.

- Episode 1: Construction 4-to-1 MUX

Multiplexing is the generic term used to describe the operation of sending one or more analogue or digital signals over a common transmission line at different times or speeds and as such, the device we use to do just that is called a Multiplexer.

The multiplexer, shortened to “MUX” or “MPX”, is a combinational logic circuit designed to switch one of several input lines through to a single common output line by the application of a control signal. Multiplexers operate like very fast acting multiple position rotary switches connecting or controlling multiple input lines called “channels” one at a time to the output.

The circuit that I am going to construct is given below:

1.png

Source of the circuit

In part 3, I have explained how to obtain NAND gates with more than 2 inputs so I will skip those steps, for the readers who want to learn please check my previous tutorials. Constructed circuit should look like as:

2.png

- Episode 2: Designing sub-circuit

In order to design sub-circuits, reader needs to put "Fixed Volt." for the "Inputs" and "Probe" for the "Outputs". This part is vital, please check it before move into other steps.
Next step is to, reader needs to give names for the fixed voltages and probes as PackagePinN (N corresponds to number of the pin), reader can do this operation in the properties function, which is explained in previous part. Final version should look like:

3.png

Next step is the save the circuit as a sub-circuit as follows:
4.png
.
After you save the sub-circuit "subcirc.xml" will be saved to SimulIDE folder. Reader should rename this file as he/she desires. I have used "fourtoonemux.subcircuit" script for my subcircuit. (note that .subcircuit extension is vital).Then reader needs to move this file to subfile, I have used data/IC74 as shown below:

5.png

Now, we have managed to create our .subcircuit file. Then we need to create our ".package file" for the subcircuit. We have given a code for this, we need to use this template.

<!DOCTYPE SimulIDE>
<package name="74HC08" pins="14" width="4" height="8">

    <pin side="left" pos="1"  type="" id="1A"  label="1A" />(html comment removed:  packagePin1 )
    <pin side="left" pos="2"  type="" id="1B"  label="1B" />(html comment removed:  packagePin2 )
    <pin side="left" pos="3"  type="" id="1Y"  label="1Y" />(html comment removed:  packagePin3 )
    <pin side="left" pos="4"  type="" id="2A"  label="2A" />(html comment removed:  packagePin4 )
    <pin side="left" pos="5"  type="" id="2B"  label="2B" />(html comment removed:  packagePin5 )
    <pin side="left" pos="6"  type="" id="2Y"  label="2Y" />(html comment removed:  packagePin6 )
    <pin side="left" pos="7"  type="" id="GND" label="GND"/>(html comment removed:  packagePin7 )

    <pin side="right" pos="7" type="" id="3Y"  label="3Y" />(html comment removed:  packagePin8 )
    <pin side="right" pos="6" type="" id="3A"  label="3A" />(html comment removed:  packagePin9 )
    <pin side="right" pos="5" type="" id="3B"  label="3B" />(html comment removed:  packagePin10 )
    <pin side="right" pos="4" type="" id="4Y"  label="4Y" />(html comment removed:  packagePin11 )
    <pin side="right" pos="3" type="" id="4A"  label="4A" />(html comment removed:  packagePin12 )
    <pin side="right" pos="2" type="" id="4B"  label="4B" />(html comment removed:  packagePin13 )
    <pin side="right" pos="1" type="" id="Vcc" label="Vcc"/>(html comment removed:  packagePin14 )
    
</package>

Reader needs to change corresponding parameters, for example in our case we just have 6 input and 1 output so, we need to delete extra parts. Reader can give name to subcircuit in the first line, and labels of input/output terminals can be designed in the bottom parts. .package file for our design should look like:

<package name="fourtoonemux" pins="7" width="4" height="8">

    <pin side="left" pos="1"  type="" id="A"  label="A" />(html comment removed:  packagePin1 )
    <pin side="left" pos="2"  type="" id="B"  label="B" />(html comment removed:  packagePin2 )
    <pin side="left" pos="3"  type="" id="C"  label="C" />(html comment removed:  packagePin3 )
    <pin side="left" pos="4"  type="" id="D"  label="D" />(html comment removed:  packagePin4 )
    <pin side="left" pos="5"  type="" id="S1"  label="S1" />(html comment removed:  packagePin5 )
    <pin side="left" pos="6"  type="" id="S2"  label="S2" />(html comment removed:  packagePin6 )
   

    <pin side="right" pos="7" type="" id="OUT"  label="OUT" />(html comment removed:  packagePin7 )

    
</package>

(Width,Height are all adjustable) Place the .package file the same direction for the .subcircuit. And do not forget the change its extension.
I have provided ".subcircuit , ".package , and ".simu" files for this example at the end of the tutorial, reader can check if desired.

We are almost done, as a last step, we need to add our circuit to main sub-circuit script,which is in data/subcircuits.xml. User need to add his/her subcircuit here. Template as follows:

<item name="74HC08" package="logic/74HC08.package" subcircuit="logic/74HC08.subcircuit" icon="ic2.png" ></item>

For our example, subcircuit code is:

<item name="fourtoonemux" package="ic74/fourtoonemux.package" subcircuit="ic74/fourtoonemux.subcircuit" icon="ic2.png">

Note that reader needs to adjust the name of the sub-circuit, and give correct extensions for the package and subcircuit files,respectively. reader can different icons by changing icon segment if desired. Now we are ready to use our subcircuit. Open SimulIDE software to check:

7.png

Please note that, our circuit is under IC74 sub-chapter since I have adjusted it above, reader can change the name of the inputs, and place for the subcircuit and the overall layer if wants.
You can check the files for this tutorial from here, and I highly recommend you to try to do it.
This tool is really vital and useful for advanced circuit design methods. If you have any questions, please feel free to ask me on Discord (Escorn#4114)
Circuits & Files that I have created for this project

Sources

Source for the quote and circuit

Curriculum



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @escorn I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x