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 email@example.com
|Free Today: September Issue of Linux Journal (Retail value: $5.99)||Sep 27, 2016|
|nginx||Sep 27, 2016|
|Epiq Solutions' Sidekiq M.2||Sep 26, 2016|
|Nativ Disc||Sep 23, 2016|
|Android Browser Security--What You Haven't Been Told||Sep 22, 2016|
|The Many Paths to a Solution||Sep 21, 2016|
- Free Today: September Issue of Linux Journal (Retail value: $5.99)
- Android Browser Security--What You Haven't Been Told
- Readers' Choice Awards 2013
- Epiq Solutions' Sidekiq M.2
- Downloading an Entire Web Site with wget
- Securing the Programmer
- The Many Paths to a Solution
- Nativ Disc
- Synopsys' Coverity
Pick up any e-commerce web or mobile app today, and you’ll be holding a mashup of interconnected applications and services from a variety of different providers. For instance, when you connect to Amazon’s e-commerce app, cookies, tags and pixels that are monitored by solutions like Exact Target, BazaarVoice, Bing, Shopzilla, Liveramp and Google Tag Manager track every action you take. You’re presented with special offers and coupons based on your viewing and buying patterns. If you find something you want for your birthday, a third party manages your wish list, which you can share through multiple social- media outlets or email to a friend. When you select something to buy, you find yourself presented with similar items as kind suggestions. And when you finally check out, you’re offered the ability to pay with promo codes, gifts cards, PayPal or a variety of credit cards.Get the Guide