Docsity

Digital System Logic Design - Lecture Notes | ECEN 3233, Study notes of Electrical and Electronics Engineering

Partial preview of the text

Download Digital System Logic Design - Lecture Notes | ECEN 3233 and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

Digital System Logic Design

James E. S4ne, Jr.

Oklahoma State University

Digital Logic Design

ECEN 3233

Digital Systems

• Digital Systems are part of every engineering

system.

• They work on groups of 1s and 0s called bits.

• Each system is a combina4on of combina4onal

and sequen4al systems that work together to

perform some task.

• How can we take what we learned earlier to

help use design a system?

Simple Design

  • 4‐bit wide operands
    • Input  A
    • Output  Z
  • Design a logic device that does the following based off of a command Opera&on Input Output Add 4 A Z=A+0100 2 or Z=A + 4 10 Output 4 X Z=0100 2 or Z=4 10

First Step

1.) Put down parts that you thing will belong to this computa4on. These parts become the datapath No4ce that I might be wrong with the parts I choose. I am just trying to think what would elements might be useful!!!!!!!

Make sure each part works first though!

A B

Z

Sel

A B

Z

Third Step

3.) Simulate – give a couple of inputs to each input and make sure the output is as expected!

Hardwire to 0100 (internally) Input Output Datapath OpCode I didn’t want the Input for one command, I wanted to output the constant 4!! [see table on page 4] Perhaps, I would have seen it earlier, but simula4on helps me see what is wrong with my design!

Final Step

4.) Define and Build control logic to make sure output works as expected.

Hardwire to 0100 (internally) Input Output Datapath OpCode OpCode Opera&on 0 Output 4 1 Add 4 Control is just as easy as you make it!! What if Wal‐Mart wanted this reversed? Hardwire to 0100 (internally) Copyright 2009 James E. S4ne, Jr. 8

Its that easy…………

Another Example

• Design a simple calculator for Wal‐Mart that they

can sell for $1.

• Each digital device uses 4 bits.

• Let’s use several digital devices (3):

– 4 word register file.

  • Stores 4 registers and is dual ported.

– Memory (storage) device

  • Stores or Reads only 1 element
  • writeMem=1 : write into memory from input of memory.
  • writeMem=0 : read from memory from output of memory.

– A carry propagate adder

Important Issues

• Wal‐Mart Customers had some issues you

have to be careful about:

– You cannot read and write into same register.

  • That is you cannot read from Register 2 and write into Register 2.

– The Const is 2 ‐bits long for no par4cular reason.

Datapath Design

Register #

  • writeReg (2 bits)
  • RA (2 bits)
  • RB (2 bits)
  • Write/Read
  • writeMem (1 bit)
  • Write (1 bit)
  • Muxes
  • S1 (1 bit)
  • S2 (1 bit) These control lines are not used all the 4me. For example, you would not need WriteMem when adding two values from the RF Control Lines

Commands or Opcodes

Opcode RS RT RD 2 bits 2 bits 2 bits 2 bits Opcode RS RD Const 2 bits 2 bits 2 bits 2 bits We arbitrarily choose to have 2 types of instruc4on formats so input is only 8 bits. The user would have to know the format or else  For instruc4on 2 or an add instruc4on For instruc4ons 0, 1, and 3 or lw, addi, and sw instruc4ons, respecsully. I could have just given a 10‐bit sequence if I was feeling lazy……..

Control Logic Structure

Goal

  • The MIPS design is just a system with a whole bunch of digital logic and

instruc4ons/commands.

  • Our goal for this exercise is to add two instruc4ons as an example (similar

to what we have to do for our project part I)

  • ori (bitwise OR immediate or OR a constant with the contents of a

register)

  • bne (branch if not equal)
  • Use our methodology in class.
  • I have given you the unmodified logic, you just have to add logic to handle these two new instruc4ons.
  • The first instruc4on will obvious use the ALU OR func4on.
  • The second instruc4on will obviously use ALU and if two values are

equal (or get a zero output when subtrac4ng).

RTL

  • RTL or Register Transfer Language is just a short form for a descrip4on digital designers to help them understand what is happening to the computa4on.
  • ori
    • [rt] = [rs] | {16’b0, imm}
  • bne
    • If ([rs] != [rt]) then PC = PC + 4 + ({{16{imm[15]}}, imm} << 2)