Using JAR libraries
Logisim has two types of circuit components: those that are designed within Logisim as combinations of components, and those primitive components that are written in Java. Logisim circuits are easier to design, but they cannot support sophisticated user interaction, and they are relatively inefficient.
Logisim contains a fairly thorough collection of built-in
libraries of Java components, but it can also load additional
libraries written by you or others. Once you have downloaded
a library, you can import it into your project by right-clicking
the project in the explorer pane (the top line) and choosing
Load Library > JAR Library.... Then, Logisim will prompt you to select the JAR file.
(In some circumstances, you may have to type the starting class name when
prompted, which would be provided by the library developer. However, a developer
typically configures the JAR library to avoid this (by including a
manifest file in the JAR with a Library-Class attribute
specifying the main class name).)
Creating JAR libraries
The remainder of this section is dedicated to a series of thoroughly commented examples illustrating how to develop Logisim libraries yourself. You should only attempt this if you're an experienced Java programmer. You will find the documentation beyond these examples fairly meager.
You can download a JAR file that allows these examples to be imported into Logisim via the Logisim Web site's Links section. That JAR file also contains the source code contained in these examples.
- Gray Code Incrementer
Illustrates the essential components of any component type using a simple example of a component that takes a multibit input and computes the next Gray code value following it.
- Library Class
Illustrates how to define a library. This is the entry point for any JAR file - the class whose name the user enters when loading the JAR library.
- Simple Gray Code Counter
Illustrates how to make a component that has internal state, in particular an 8-bit counter that iterates through Gray codes.
- Gray Code Counter
Demonstrates a complete, fairly sophisticated component with which the user can interact. It implements a Gray code counter where the number of bits remembered is customizable, and where the user can edit the current value by clicking on it with the Poke Tool and typing a value.
- General information for those developing third-party libraries.
The code in this example JAR library is released under the MIT license, a more permissive license than the GPL, under which the rest of Logisim is released.
Copyright (c) 2009, Carl Burch.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Next: Gray Code Incrementer.