I'm designing a series of arithmetic circuits for a Digital Design class. I must use Electric VLSI for layout and LTSpice from simulation. Since I'm builnd circuits with a lot of inputs (up to 64 for the 32x32 multiplier) I'm trying to automate the simulation process, I wish to:

  1. Generate a list of input vector using Matlab
  2. Import the as a .vec file
  3. Evaluate the average power consumption

Is there a tutorial/resource on this? The best I could find are

And even ther the only example I could find reads:

enter image description here

Since the 1st and 2nd commands are options I tried to launch the simulation only by adding the .trans command, the .vec one and my model file for devices, but no luck. I'm missing something.

I think I understood how to write a .vec file, but not how to embed it into an actual simulation.

For a simple full-adder I'd use:

enter image description here

How to set up the Spice command to execute the digital simulation given this input? Is there a better reference/place I can look for?

Best regards, Andrea

  • \$\begingroup\$ LTspice does not know the .vec command, but if your problem is generating an input vector as a series of impulses, then you can convert the vector into a time-value pair for a PWL source (see the manual for full description). For example 0 1 2 3 means at time t=0 the value is 1V, at t=2s it's 3V, etc. So a vector of 01101 with a 5V peak, 1s period, and 20ms rise time would be 0.99 0 1.01 5 1.99 5 3.01 0 3.99 0 4.01 5. The complete SPICE line for a voltage source would be Vin IN 0 <...>, where IN is the output node (which will be used as an input in the schematic). [cont'd] \$\endgroup\$ – a concerned citizen Feb 16 '18 at 6:50
  • \$\begingroup\$ For amplitude or time scaling, you can use value_scale_factor or time_scale factor. For a repeating sequence you can use repeat for <...>/endrepeat, or repeat forever/endrepeat. See ltwiki.org/?title=Undocumented_LTspice for more. \$\endgroup\$ – a concerned citizen Feb 16 '18 at 6:52
  • \$\begingroup\$ Thanks for the comment, I'm aware of the possibility to use the PWL generator. My question about PWLs is: if I need 64 (32+32) input for my circuit (i.e. 32x32 binary multiplier) do I need to create 64 PWL generators and setup them individually? \$\endgroup\$ – a_bet Feb 16 '18 at 9:26
  • \$\begingroup\$ I'm afraid you'll need as many sources as there are inputs. Still, if you use LTspice's A-devices, then you can simplify the PWL points to triangles, midpoint being the transition, while the A-device can have ref=0.5 (default, I think). The slight advantage will be the points will all be distanced, so the simulator won't need to reduce the step around the transitions... Actually, it just occured to me, it will, anyway, for the rest of the circuit, so not much of a simplification. I wish I could say a wavefile source would allow for a single source with a bus of n channels. Alas... \$\endgroup\$ – a concerned citizen Feb 17 '18 at 7:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.