Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

An assignment demonstrating digital circuit design from truth tables; recreating circuits in Assembly to examine boolean logic.

License

Notifications You must be signed in to change notification settings

allegheny-college-cmpsc-200-fall-2023/circuit-scramble-assignment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CMPSC 200: Circuit Scramble

Date
5 October 2023 Assigned
13 October 2023 Due, end of lab
Status GatorGrader

Learning objectives

  • develop truth tables as tests of digital circuitry
  • evaluate basic boolean logic as expressions of digital circuits
  • implement boolean logic in ARMv6 assembly to describe digital circuits
  • read and/or revise circuit diagrams to reflect changes in functionality

Introduction

This isn't a democracy

Equality circuit

Complete this work in equality/program.S.

We've retrieved some rocks with a special principle: if any two rocks from the sample sit next to each other long enough, they have a 50% chance of leeching their core element to their neighbors. This only happens in pairs, and we've isolated a sample of eight (8) rocks (4 pairs) to examine if any pair of two (2) contains falsite (0) or truthite (1).

This circuit should report a 1 whenever the pairs match.

Lab: Majority circuit

Complete this work in the following files:

The Mining Council, as you might expect, is run by robots. (They're really nice, tho.) However, they make all of their decisions via a process which captures the majority of votes either against (0) or for (1) a proposition. They've largely been doing this via punch cards. But, in space, (as the saying commonly goes) there's no one to repair even punch card machines.

Our robot overlords need a circuit to do this quickly and efficiently. Hence, they turn to the only folks who are known for neither of these traits: humans. But, we certainly have ingenuity on our sides. Can you design such a circuit?

Here're some specifications:

  • there are 3 robots on the council
  • they can vote either 0 or 1
  • the circuit needs to cover all combinations

You'll need to provide a full truth table in our report.

Assignment "Hacks"

See the Suggestion below to challenge yourself to implement a Hack. As always, you are allowed to develop your own Hack to satisfy this stretch goal. Place the code for the Hack inline with the code in the corresponding file.

In order to recieve credit for the Hack, you must fill out the hack.md file located in the docs folder.

Note: for both hacks, you'll definitely need to add gates to the circuit designs.

equality

We're currently testing numbers in pairs. What happens if you try to evaluate numbers in triple? Replace the signals declaration in .data with the following:

signals:    .byte   0, 0, 1
            .byte   0, 1, 1
            .byte   1, 1, 1
            .byte   0, 0, 0
            .byte   1, 1, 0
            .byte   0, 1, 0
            .byte   1, 0, 1
            .byte   1, 0, 0

In addition, provide a truth table for the outcomes in hack.md. This will help you guarantee that your outcomes are correct.

majority

unanimity

The people have spoken. They're not happy with only 3 robot overlords. They want more of them: 5 to be exact.

But there's a catch: "majority" this context does not mean 50% + 1 (i.e. 3). It means unanimity. That's right: there's no majority like a unanimous one, especially with automated decisions made by robots. Here's some data to use as a test. Replace votes with:

votes:  .bytes  0,0,0,0,0
        .bytes  0,0,0,0,1
        .bytes  0,0,0,1,0
        .bytes  0,0,0,1,1
        .bytes  0,0,1,0,0
        .bytes  0,0,1,0,1
        .bytes  0,0,1,1,0
        .bytes  0,0,1,1,1
        .bytes  0,1,0,0,0
        .bytes  0,1,0,0,1
        .bytes  0,1,0,1,0
        .bytes  0,1,0,1,1
        .bytes  0,1,1,0,0
        .bytes  0,1,1,0,1
        .bytes  0,1,1,1,0
        .bytes  0,1,1,1,1
        .bytes  1,0,0,0,0
        .bytes  1,0,0,0,1
        .bytes  1,0,0,1,0
        .bytes  1,0,0,1,1
        .bytes  1,0,1,0,0
        .bytes  1,0,1,0,1
        .bytes  1,0,1,1,0
        .bytes  1,0,1,1,1
        .bytes  1,1,0,0,0
        .bytes  1,1,0,0,1
        .bytes  1,1,0,1,0
        .bytes  1,1,0,1,1
        .bytes  1,1,1,0,0
        .bytes  1,1,1,0,1
        .bytes  1,1,1,1,0
        .bytes  1,1,1,1,1

In addition, provide a truth table for the outcomes in hack.md. This will help you guarantee that your outcomes are correct.

dissent

But there's another catch: robots love shame. In fact, they don't like dissenters at all. In the event where there is a an 80% majority (i.e. 4 votes one way), the circuit should report a 1 when there's only one dissenter. Use the same alteration to votes as above and write your truth table in hack.md.

stack attack

Given the high number of inputs, there's some juggling involved. If you can implement use of the stack pointer (i.e. PUSH, POP instructions), that'd be a welcome improvement to this circuit -- especially if you attempt the dissent or unanimity hacks. In fact, I think it's almost required if you do so.

Implement use of the stack to PUSH and POP values so that we don't need to interface with raw, uncooked memory.

If you attempt only this implemention with the 3-value majority circuit, you do not need to provide another truth table (that's already done in report.md). However, there's an additional question in hack documentation labeled for you.

Changes to files in .vscode

Based on your system setup (refer to your hello-blinky assignment), you will need switch out the .vscode folder in each exercise with the last working copy.

See our wiki's entry on "Configuring Assignments" for more inforamtion.

About

An assignment demonstrating digital circuit design from truth tables; recreating circuits in Assembly to examine boolean logic.

Topics

Resources

License

Stars

Watchers

Forks