Skip to content

mrtaz77/Computer-Architecture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Computer-Architecture

A collection of the projects done under the computer architecture course of undergrad.

Navigation

Tools

  1. Logisim(2.7.1), download EXE (Requires JRE 1.5.0) or JAR (Works for JRE >= 1.5.0). Open .circ files using this.
  2. Atmel Studio 7.0 . Download link
  3. Proteus Version 8.15. Download link. Open .pdsprj files using this.
  4. Extreme burner. Download link. For burning hex files into atmega32 for hardware simulation

Issue with 7400-lib.circ Logisim Library

The originally downloaded 7400-lib.circ had a bug related to the IC-7483. The $C_{out}$ pin was an input pin instead of the desired output pin.This issue was solved using this .circ file. Also some changes were made to the 7400-lib.circ file for the design.

Projects

Contents

Folder ALU FPA MIPS
Specification .. .. ..
Report .. .. ..
Logisim Circuit .. .. ..

ALU

ALU img

Content

Circuit Design

The original circuit had a bug which were fixed using this file.
Also for the intuitions behind the design check optimization

Software Simulation ALU

logisim_ALU

Useful Tools

  • Wire Counter calculates the number of wires used in a .circ file.

    • Make sure that your.circ file(whose wire is to be counted) and the wireCount.py are in the same directory.
    • Replace the file_path with the name of your.circ and run the .py.
    • An estimate will be given.
  • Tester checks whether the truth table generated from the ALU.circ is correct or not.

    • Open the circuit in Logisim
    • Go to the Project tab and click Analyze Circuit
    • A warning dialog box may appear, click OK
    • The truth table is shown.
    • Press Ctrl+A. Copy.
    • Paste the output here in truth_table.txt
    • Most importantly, in the code, change the check_row function's following fragment as per your specifications.
     if(control == 0):
         Y = A + 2**n_bits - 1
     if(control == 1):
         Y = A + 2**n_bits - B - 1
     if(control == 2):
         Y = A + 2**n_bits - 1
     if(control == 3):
         Y = 2**n_bits - A // negation
     if(control == 4):
         Y = A + 2**n_bits - B
     if(control == 5):
         Y = A & B
     if(control == 6):
         Y = A ^ B
     if(control == 7):
         Y = A ^ B
    • Run check_ALU.py
    • For the entire report, check the generated report.txt.

    The followed naming convention:

      Control bits = cs0, cs1, cs2
      A            = A0, A1 etc
      B            = B0, B1 etc
      S            = S0, S1 etc
      Cout         = Cout
      C, V, S and Z are the status flags
    

ICs and symbols used

Here is a list of ICs, symbols and their meanings used in the ALU.

FPA

Software Simulation FPA

logisim_FPA

MIPS

mips_hardware

Software Simulation MIPS

Logisim

logisim_MIPS

Proteus

proteus_MIPS

How to run

  1. Go to the Compiler directory and open a .asm file with the desired mips assembly code.
  2. Run the asm_compiler.py.
python asm_compiler.py <input>.asm
  1. The following files will be formed.
    intermediate.asm - Asm file with intermediate code for push and pop instructions.
    log.txt - Log file for the resulting hex code of all instructions and any error if found.
    instruction.hex - Hex code for instruction memory for logisim simulation.
    atmega32_instruction.txt - Hex code for instruction memory for atmega32 simulations used in proteus and hardware design.
  2. Proteus and hardware simulation
    • Copy the atmega32_instruction.txt.
    • Open the main.c in atmel studio and navigate to the unsigned int instruction[256] array. This is the instruction memory of our mips. Paste the instructions copied as R.H.S of this array.
    • Build the solution and a new hex file will be formed.
      • For hardware simulation, burn this hex file into the atmega32 simulating the instruction memory using extreme burner.
      • For proteus simulation, open the circuit using proteus. Go to the atmega32 with the name Instruction Memory and load the hex file formed into it.
    • Clock is negative edge triggered. Execute next instruction via clock. Also, supports a reset switch for reseting program counter.
  3. Logisim simulation
    • Open the circuit in logisim and follow the video to load the instruction.hex into intruction memory.

    demo.vid.compressed.mp4