If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Nand Gate
13 posts
• Page 1 of 2 • 1, 2
Nand Gate
Well I think I could use some help. I am trying to make a Nand gate that will mimic a Transistor Transistor Logic (TTL) Nand gate. Thats a hardware Nand gate that will pass Streamin data. I am not sure if the coding is right. Sometimes it SEEMS to work right and other times NOT. It should only work with values of 0 and 1, so I also coded a little module that will convert streamin data say from a Osc to just 0 and 1. Any help, suggestions, examples, etc., will be very greatly appreciated. Many thanks, BobF.....
- BobF
- Posts: 598
- Joined: Mon Apr 20, 2015 9:54 pm
Re: Nand Gate
- Code: Select all
streamin in1;
streamin in2;
streamout out;
out= 1 & ((in1 & in2) ==0);
- KG_is_back
- Posts: 1196
- Joined: Tue Oct 22, 2013 5:43 pm
- Location: Slovakia
Re: Nand Gate
Hey KG,
Thanks a million! Sorry to ask for more, but if you have a moment what would it be for a NOR gate and XOR gate?
I really have trouble figuring out Boolean for some reason.
Thanks again. BobF
Thanks a million! Sorry to ask for more, but if you have a moment what would it be for a NOR gate and XOR gate?
I really have trouble figuring out Boolean for some reason.
Thanks again. BobF
- BobF
- Posts: 598
- Joined: Mon Apr 20, 2015 9:54 pm
Re: Nand Gate
Actually there is even better solution to this. Assembler code has opcodes for preforming AND, OR, XOR and NOT(x) AND (also called ANDNOT). XOR is present only in the latest version of FS and ANDNOT has a syntax colouring bug in older versions (although it works normally)
Simple assembler modules will provide such functionality very easily. Also boolean logic will work very same way as for bitmasks if both numbers are the same.
Here are some codes for what you ask (same have two implementations, one for older FS versions,which not include XOR). Simply copy it to assembler component and remove parts you do not need (for better performance). Also "andps xmm0,F1;" code makes it work with input 1 rather than bitmasks.
Simple assembler modules will provide such functionality very easily. Also boolean logic will work very same way as for bitmasks if both numbers are the same.
Here are some codes for what you ask (same have two implementations, one for older FS versions,which not include XOR). Simply copy it to assembler component and remove parts you do not need (for better performance). Also "andps xmm0,F1;" code makes it work with input 1 rather than bitmasks.
- Code: Select all
streamin A;
streamin B;
streamout outXOR;
streamout outNAND;
streamout outNOR;
float F1=1;
int In1=-1; //=bitwise all true
//XOR
movaps xmm0,A;
xorps xmm0,B;
andps xmm0,F1;
movaps outXOR,xmm0;
//XOR old version
movaps xmm0,A;
movaps xmm1,xmm0;
movaps xmm2,B;
andnps xmm0,xmm2;
andnps xmm2,xmm1;
orps xmm0,xmm2;
andps xmm0,F1;
movaps XOR,xmm0;
//NAND
movaps xmm0,A;
andps xmm0,B;
andnps xmm0,In1;
andps xmm0,F1;
movaps outNAND,xmm0;
//NOR
movaps xmm0,A;
orps xmm0,B;
andnps xmm0,In1;
andps xmm0,F1;
movaps outNAND,xmm0;
Last edited by KG_is_back on Sat May 02, 2015 12:57 pm, edited 1 time in total.
- KG_is_back
- Posts: 1196
- Joined: Tue Oct 22, 2013 5:43 pm
- Location: Slovakia
Re: Nand Gate
Hi again KG,
Thanks many times over, you are a life saver. Now I just have to learn ASM and Boolean both (kidding around).
Have a great one! Later, BobF.....
Thanks many times over, you are a life saver. Now I just have to learn ASM and Boolean both (kidding around).
Have a great one! Later, BobF.....
- BobF
- Posts: 598
- Joined: Mon Apr 20, 2015 9:54 pm
Re: Nand Gate
I think it shold read
int In1=-1; // bitwise true
not float.
int In1=-1; // bitwise true
not float.
-
martinvicanek - Posts: 1328
- Joined: Sat Jun 22, 2013 8:28 pm
Re: Nand Gate
martinvicanek wrote:I think it shold read
int In1=-1; // bitwise true
not float.
Ops.. my bad... fixed in original post...
- KG_is_back
- Posts: 1196
- Joined: Tue Oct 22, 2013 5:43 pm
- Location: Slovakia
Re: Nand Gate
Hello All,
What version of Flowstone does "andnps" show up in? Mine does not seem to have it. I am using version 3.02 within Fl Studio. Thanks Bobf.....
What version of Flowstone does "andnps" show up in? Mine does not seem to have it. I am using version 3.02 within Fl Studio. Thanks Bobf.....
- BobF
- Posts: 598
- Joined: Mon Apr 20, 2015 9:54 pm
Re: Nand Gate
andnps is in Flowstone since Synthmaker 2, I think. However, it has a syntax colouring bug - it is not recognized by assembler as valid opcode (code is marked black after it), although it works. Also one minor problem I forgot about: it works with registers only. So replace every "andnps xmm0,In1;" with "movaps xmm2,In2; andnps xmm0,xmm2;" and it should work.
- KG_is_back
- Posts: 1196
- Joined: Tue Oct 22, 2013 5:43 pm
- Location: Slovakia
Re: Nand Gate
3.0.8 fixes the syntax coloring bug. Otherwise KG is right that it has been there all along.
-
martinvicanek - Posts: 1328
- Joined: Sat Jun 22, 2013 8:28 pm
13 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 20 guests