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
|Designing Electronics with Linux||May 22, 2013|
|Dynamic DNS—an Object Lesson in Problem Solving||May 21, 2013|
|Using Salt Stack and Vagrant for Drupal Development||May 20, 2013|
|Making Linux and Android Get Along (It's Not as Hard as It Sounds)||May 16, 2013|
|Drupal Is a Framework: Why Everyone Needs to Understand This||May 15, 2013|
|Home, My Backup Data Center||May 13, 2013|
- Designing Electronics with Linux
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Dynamic DNS—an Object Lesson in Problem Solving
- Using Salt Stack and Vagrant for Drupal Development
- Why Python?
- New Products
- A Topic for Discussion - Open Source Feature-Richness?
- Validate an E-Mail Address with PHP, the Right Way
- What's the tweeting protocol?
- Tech Tip: Really Simple HTTP Server with Python
- Understanding the Linux Kernel
1 min 48 sec ago
2 hours 31 min ago
- Kernel Problem
12 hours 34 min ago
- BASH script to log IPs on public web server
17 hours 1 min ago
20 hours 37 min ago
- Reply to comment | Linux Journal
21 hours 9 min ago
- All the articles you talked
23 hours 33 min ago
- All the articles you talked
23 hours 36 min ago
- All the articles you talked
23 hours 37 min ago
1 day 4 hours ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi
It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?