1. Goals for this week

  1. Gain experience with the Logisim logic circuit simulator.

  2. Build an XOR component.

  3. Introduce Lab assignment #3.

2. Getting your code

Both you and your partner should clone your Lab3 repo into your cs31/labs subdirectory.

  1. get your Lab3 ssh-URL from the CS31 git org. The repositor to clone is named Lab3-user1-user2, where user1 and user2 are the usernames of you and your Lab 3 partner.

  2. in your lab repo on github you should see two sub-directories named warmup-code and starting-point.

  3. cd into your cs31/labs subdirectory

    $ cd ~/cs31/labs
    $ pwd
  4. clone your repo

    $ git clone [your_Lab3_repo_url]

There are more detailed instructions about getting your lab repo from the "Getting Lab Starting Point Code" section of the Using Git for CS31 Labs page.

3. Logisim Demo

For this lab, we’ll be using Logisim to create and test digital circuits using the logic gates (AND, OR, NOT, etc.) we’ve been talking about in class.

  • I suggest working in the CS lab on Logisim rather than logging in remotely.

  • Logisim will run very slowly if you are remotely logged in due to X-forwarding events (i.e., using ssh -Y on Mac or Linux to enable X-forwarding).

  • Alternatively, you can install Logisim on your own computer, and use git to push/pull your .circ file to/from your computer and your CS account. If you do this, you still need to ensure that your circuit file works on Logisim running on our system, the school computer labs is where we’ll be doing the grading!

We will start by demoing the basics of Logisim (adding gates, inputs, and outputs), and then we will demo building a bit swapper for 4-bit values.

4. Your turn!: Getting Started with Logisim

  • Work with your partner to build an XOR gate using only AND, OR, and NOT gates (plus inputs and outputs). Build your gate as a new component that you can then deploy in main.

  • Refer to the Logisim beginner’s guide for the details of building an XOR gate, including a circuit diagram.

  • You do not need to submit anything for this part, but you should trying some things out in logisim before jumping into the two required parts of the lab.

  • Start by going through the Logisim Beginner’s Tutorial and try out building the XOR circuit. So that both you and your lab partner can try out logisim, let’s create two copies of firstcircuit.circ in the warmup-code folder.

    $ cd Lab3-your-partnership
    $ cd warmup-code
    $ cp firstcircuit.circ firstcircuit-yourID.circ
  • You can now modify your own copies of firstcircuit-yourID.circ. Run logisim with the name of the file you want to use for your new circuit, for example:

    $ logisim

    and choose File→SaveAs to choose a file name (and location) for the tutorial circuit. Then follow along the tutorial to build an XOR circuit and test it.

  • You can also try changing the inputs and outputs to be 4 bits each instead of 1 bit each. And you could try creating a new circuit for this (Project→Add Circuit) and adding some circuitry for testing the circuit,

  • Once you are done modifying your files, make sure that each of you execute the whole of the following sequence (first partner1 and then partner2):

    $ git pull
    $ git add filename
    $ git commit -m "your commit message"
    $ git push

5. Lab 3 Assignment

Next, let’s look over the Lab 3 assignment and then get started on it!