Digital and Analog Circuit Simulation with Ksimus
I took a Computer Logic Design class in college, so when I stumbled upon the Ksimus Circuit Simulator, I was intrigued. At the risk of waxing nostalgic, I remember what it was like to build circuits in school. We'd spend hours the night before the lab designing our circuit, being careful to list each interconnection. We had to keep track of which pin numbers on each chip were to be connected. Then, we took our design and our box of parts to the lab. When we got to the lab, we were given a breadboard and a power supply. Then began the tedium of connecting everything up.
I will admit to miswiring at least one circuit and burning up a chip or two. Those little buggers can get hot! Then, there were times when our original design just simply didn't work. In those cases, we had to redesign our project and get it built in time to be graded. Even though the class was fun, the labs were very stressful. Fortunately, we have better tools now.
Ksimus is a circuit simulator that allows you to build digital and analog circuits with discrete components and simulate them in real time. Ksimus does have its limitations though. Ksimus doesn't supply any of the larger circuits like addressable memory or 8-bit adders, but you can build one for yourself and package it up as a Ksimus module. Also, because Ksimus provides only discrete logic components, you're probably not going to be designing a quad-core microprocessor or anything moderately complex. That said, you certainly can use Ksimus to learn about computer logic design, and you even can use it to simulate basic logic circuits. But, best of all, it's just fun to play with!
Ksimus' user interface is fairly straightforward. You have a list of components on the left side of the window and a canvas on the right side. To place a component on the canvas, you click on the component and then click on the canvas where you want the component to appear. Making a connection between two devices is also intuitive. You place your cursor on the first pin, and you'll notice that the cursor changes. Then, you hold the left mouse button down and drag the cursor to the second pin and release the button. I had been playing with Ksimus for some time before I realized what the cursor was changing to when I made an interconnection; it was turning into a tiny wire wrap tool! Ksimus is smart enough not to let you connect two inputs or two outputs, so you don't need to worry about burning up your virtual logic gates!
When you've built a design you want to test, you can start the simulation from the menu bar at the top.
The Ksimus program is easy to use, and there are lots of components available for use in your designs. Obviously, any digital logic simulator will have the typical AND, OR, NOT and XOR gates.
Many of the components are configurable. For example, the counter component can be configured to be anything from a 3-bit counter to a 16-bit counter. There also is a variety of Flip Flops included in Ksimus, including JK, RS and D Flip Flops. In fact, there are two different D Flip Flops: one is a single gate, and the other is a module with anywhere between 1 and 26 gates. With the addition of some extra addressing logic, which is included with Ksimus, you can build your own addressable memory almost trivially. Ksimus also provides both a variable size Muliplexer as well as a Demultiplexer.
Ksimus allows you to provide input for your circuits from various sources. One of the most basic input sources is the clock generator. The clock generator allows you to configure initial startup delay as well as on-time and off-time duty cycle. You also can include buttons that can be “pushed” by the user during simulation. Ksimus includes both a momentary contact/disconnect switch and a latching switch, and these switches don't bounce like real switches do! Of course, there also are the boolean true and false values that can be provided as constant inputs to your circuit.
Logic circuits wouldn't be any fun if they didn't produce any output, and Ksimus provides users with the LED output as well as a 7 Segment Display, with built-in decoder. To use the 7-Segment Display, you simply provide the appropriate binary value on its four input lines, and it displays the appropriate number. You also can use the Data Recorder and Text Recorder as outputs for your circuit. The Data Recorder is essentially a multi-channel logic probe. You simply add (and connect) input channels to the Recorder and run your simulation. Then, you can open up the probe's graph and watch the display in real time. The Text Recorder performs the same function, except that it logs to an external file for later analysis.
Figure 1 shows a simple circuit I built in just a couple minutes. This circuit uses a clock signal to drive a counter. The output of the counter is used as an address for a demultiplexer that simply drives a row of LEDs. The circuit simply strobes the LEDs in order—a simple but effective demonstration.
So far, you've seen a pretty detailed rundown on the digital capabilities of Ksimus, but the program also has quite a few floating-point or analog capabilities. Using the wave-form generator and various arithmetic operators, I was able to build up some fairly complex wave-forms to supply to my circuit. Using these functions would let you create a model of a physical phenomenon and interface it with your digital circuit for simulation.
The floating-point arithmetic components include adders, subtractors, dividers and multipliers. You also can use exponential, log and trigonometric functions in your simulation.
The floating-point comparison components allow you to compare two analog signals and output an appropriate digital logic level. The Data Selector component lets you use a digital address to select one of many analog signals. You also can create inputs that have a constant analog value. From these components, it's easy to see how you could build an Analog-to-Digital converter or a Digital-to-Analog converter.
The only variable input I found useful for analog input was the Slider. The Slider allows you to vary the output voltage manually during the simulation. You can configure the upper and lower limits of the output too.
As you can see, Ksimus' analog capabilities are fairly complete. Figure 2 shows an analog circuit I built to demonstrate the Slider input as well as the Data Recorder. In this circuit, I have a sine wave and an analog slider that ranges from -1 to 1. I send these two outputs into the two comparison operators and get a digital output that I use to drive a couple LEDs. I've also included a label that displays the actual value being output by the slider. Finally, you can see the various wave forms and logic states in the graph windows. When the simulation is running, I can adjust the slider to change the relative duty cycle of the two LEDs.
So, there you have it. Ksimus is a great laboratory for exploring digital logic as well as analog interfacing problems. And like I said earlier, it's a lot of fun to play with!
Mike Diehl is a freelance Computer Nerd specializing in Linux administration, programing, and VoIP. Mike lives in Albuquerque, NM. with his wife and 3 sons. He can be reached at firstname.lastname@example.org
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Profiles and RC Files
- Maru OS Brings Debian to Your Phone
- Astronomy for KDE
- Git 2.9 Released
- OpenSwitch Finds a New Home
- Understanding Ceph and Its Place in the Market
- SoftMaker FreeOffice
- Snappy Moves to New Platforms
- The Giant Zero, Part 0.x
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide