Set default value for input

An area for asking questions, making suggestion, share ideas and place circuit examples.
Alexander
Posts: 46
Joined: Tue May 08, 2012 11:04 am

Set default value for input

Post by Alexander »

In real electronic circuits it is called internal pull up or pull down resistor.
In this program you may want to design multifunction circuits with more inputs and minimize wires count, leaving inputs unpluged (floating).
There is no standard way to do it, so I've found how to make it using available functions.
Attachments
default_value.CircuitProject
(44.87 KiB) Downloaded 923 times
Hans Cadans
Posts: 57
Joined: Thu Apr 24, 2014 12:30 pm

Re: Set default value for input

Post by Hans Cadans »

Hello Alexander,

It might be, that I don't fully understand you.

You are completely right, when you say that, not used, inputs must have a defined level.
For AND-gates, the unused input has a HIGH level, for OR-gates the unused input has a LOW level.
As you mentioned, it is accomplished by pull-up c.q. pull-down resistors.

However, in my opinion, the gates used in logiccircuits, behave in the same way.
So, your additional circuit is not really necessary.

But, your circuit can be used in the next case.
When a n-bits adder has more sources (connected to one of the inputs), you will have to connect these sources,
with the aid of a multiplexer or with the aid of Tri-State circuits.
If all these sources are in the HIGH impedance mode, sometimes it is easy to have a defined input for that adder.
And here your circuit comes in.

By the way, I already needed such a circuit before and that's why I have designed such a circuit earlier
and I used less components.
If you are interested then you can open the attached file (your file, with my idea included)

If you do disagree with me, please let me know.

Hans Cadans
Attachments
default_value.CircuitProject
(90.5 KiB) Downloaded 852 times
Alexander
Posts: 46
Joined: Tue May 08, 2012 11:04 am

Re: Set default value for input

Post by Alexander »

First I had different circuits for pull up and pull down.
Pull up

Code: Select all

  +---+
X-|&  |
  |   +-Q
1-|   |
  +---+
Pull down

Code: Select all

  +---+
X-|or |
  |   +-Q
0-|   |
  +---+
Then combined it by stupidly multiplexing them. Didn't think about simplifying it so much! So they works the same!
My usecase is when using it for multifunction circuits to minimize wires. For example, I have an up/down counter. But now I need an up counter only, so I need to plug "1" to set the up direction. But if the up/down selector defaults to "1", I'll get an up counter by default.
Also, my counter counts by arbitrary step, which defaults to 1.
Alexander
Posts: 46
Joined: Tue May 08, 2012 11:04 am

Re: Set default value for input

Post by Alexander »

I've build an adder/subtractor using ROMs. This must speed up complex circuits. This also shows the usecase for defalt values.
Attachments
rom_add_sub.zip
(17.09 KiB) Downloaded 855 times
Alexander
Posts: 46
Joined: Tue May 08, 2012 11:04 am

Re: Set default value for input

Post by Alexander »

This is a simplified version as suggested by Hans Cadans.
Attachments
default_value_2.CircuitProject
(37.86 KiB) Downloaded 992 times
Hans Cadans
Posts: 57
Joined: Thu Apr 24, 2014 12:30 pm

Re: Set default value for input

Post by Hans Cadans »

Hello Alexander,

If you really want to speed up your circuits, then you better leave out the DEF-circuits.

Hereafter follows, in my opinion, how logiccircuits acts
Before the program starts running your circuit, your circuit will be evaluated first.
Then it will be optimized according to Boolean laws. Variables in subcircuits will be treated as constants.
Splitters "disappear". Every circuit, you add, will slow down the speed.
Each circuit will be subject of calculation.

In real life, I doubt, if the solution with a ROM works faster. You have to compare the acces-time of a ROM
and the propagation delay time of XOR-gates.

So I've added a modified circuit that will work "faster"'
I also have added some ROM's for the AND, OR and XOR-function. They can handle bytes.

In case you have manually filled your Rom, I can send you a EXCEL-application, which can produce these ROM'sadans

best regards
Hans Cadans
Attachments
rom_add_sub.CircuitProject
(933.11 KiB) Downloaded 841 times
Alexander
Posts: 46
Joined: Tue May 08, 2012 11:04 am

Re: Set default value for input

Post by Alexander »

Of course, ROMs in most cases will be slower in real circuits. But here we talking about simulator's speed. I want to be able to simulate a huge circuits, like CPUs with graphics. It is something, that other people has created and sometimes it works very slow! And porting things to ROMs does help, but not always!
You've created a ROM's for XOR, OR and AND, but as far as I've tested it even gets slower! But adder and incrementor is faster when using ROMs. You can check this by comparing the actual frequency when running the circuit at max speed.
Here I've built a counter tooking into account everything we talked here about optimisation and even more. But then changed the native XOR to ROM, and it got slower! Check this by running both.
Attachments
counter_rom_benchmark.zip
(80.04 KiB) Downloaded 861 times
Hans Cadans
Posts: 57
Joined: Thu Apr 24, 2014 12:30 pm

Re: Set default value for input

Post by Hans Cadans »

Hello Alexander,

I agree with you, that your 8-bits AND, OR and XOR circuits, which operates bit by bit, work faster than the ROM's.
So, I wondered, you used a ROM in your ADD/SUBtract circuit.

I thought, that you, maybe, manually filled the ADD/SUBtract ROM.
And if you wanted to do this for the logic functions, it would be a lot of work,
and I want to prevent you, doing tedious work
So, I made them with a EXCEL-file.

I've seen that your counters operate faster than mine.

Best Regards,
Hans Cadans
Alexander
Posts: 46
Joined: Tue May 08, 2012 11:04 am

Re: Set default value for input

Post by Alexander »

I've figured out later, that this trick doesn't always help. I'm generating ROMs with the node.js script. But the complex circuits may be easily copied to ROM's. All you need is a counter. Plug counter output to your circuit and to the address of the RAM. The output of your circuit plug to the data input of the RAM. Clock the counter and RAM from the same clock. Set RAM to preserve state. Then you can save and load its content to ROMs.
Yes, I am interesting about how it is done with EXCEL.
User avatar
admin
Site Admin
Posts: 406
Joined: Sun Jun 14, 2009 10:53 pm
Contact:

Re: Set default value for input

Post by admin »

You can also use universal macro assembler for feeling ROM.
https://bitbucket.org/EugeneLepekhin/fusion/downloads/
Post Reply