Simulate bit stream in LTspice

Thread Starter

k1ng 1337

Joined Sep 11, 2020
1,038
Hi,

How can I simulate an arbitrarily long bit stream in LTspice? For example, I want to send 1000100101 where each bit is 1ms in duration with a rise and fall time of 1ns. My goal is to observe the modulation caused by the bit stream (n bits long) to see if there is an effect downstream. Thanks for the help.
 

ericgibbs

Joined Jan 29, 2010
21,391
Hi king,
Create a text file of the 1's & 0's and send it as a PWL file in a voltage source.

E
Use LTSpice Help > PWL > Voltage source, shows examples.
 

eetech00

Joined Jun 8, 2013
4,704
Hi king,
This example should get you started.
Period 1mSec, rise/fall 1nSec
Keep the files in the same folder of LTSpice.

E
The correct way is to define a "word" length, then use a clock, counter, and logic to set/clear specific bit positions in the word for transmission
.
 

Papabravo

Joined Feb 24, 2006
22,058
You can build a ROM (Read Only Memory) with a diode matrix, use a counter as the address register for the word lines, load an n-bit word into a shift register and clock the data out of the shift register. You can use the diode matrix to create an arbitrarily long sequence.
 

Thread Starter

k1ng 1337

Joined Sep 11, 2020
1,038
Hi king,
This example should get you started.
Period 1mSec, rise/fall 1nSec
Keep the files in the same folder of LTSpice.

EView attachment 324943View attachment 324944
Eric again with the win! Thanks! I see you plotted a continuous line with the text file which is an interesting approach. Is there a way to send just the binary string? The characteristics of the square wave won't change. I suppose I can ask AI to convert a large string into the text file format but these tasks a prone to error.

Also, notice the slow transition at 8ms for AM_MOD, do you think it's an artifact? In any case, now I can compare strings in spice to what's on the scope. Thanks again.

dg5.png

The correct way is to define a "word" length, then use a clock, counter, and logic to set/clear specific bit positions in the word for transmission
.
Yes but each has to be hardcoded no? That's gonna be a very complex schematic for even a 8 or 16bit word!
 

eetech00

Joined Jun 8, 2013
4,704
Eric again with the win! Thanks! I see you plotted a continuous line with the text file which is an interesting approach. Is there a way to send just the binary string? The characteristics of the square wave won't change. I suppose I can ask AI to convert a large string into the text file format but these tasks a prone to error.

Also, notice the slow transition at 8ms for AM_MOD, do you think it's an artifact? In any case, now I can compare strings in spice to what's on the scope. Thanks again.

View attachment 324977



Yes but each has to be hardcoded no? That's gonna be a very complex schematic for even a 8 or 16bit word!
No...that is the function the counter and logic provides. It's only as complex as you need it to be.
 

Papabravo

Joined Feb 24, 2006
22,058
I guess you didn't like the diode matrix ROM - too bad, it seems like an elegant solution from the days befor silicon memory.
 

Thread Starter

k1ng 1337

Joined Sep 11, 2020
1,038
No...that is the function the counter and logic provides. It's only as complex as you need it to be.
Is this different than what Papa suggested? How about an example?

I guess you didn't like the diode matrix ROM - too bad, it seems like an elegant solution from the days befor silicon memory.
I missed your post but I'll check it out. However, I must say a working example can keep even the brightest of minds from going to dark places.
 
Top