The Multicycle Processor II CPSC 321 - PowerPoint PPT Presentation

About This Presentation
Title:

The Multicycle Processor II CPSC 321

Description:

hold output of that unit until value is used in next clock cycle ... Drain ( ) Drain (-) Source ( ) Source (-) Current Flow. CMOS Circuits. Simple. Avoids difficulties ... – PowerPoint PPT presentation

Number of Views:46
Avg rating:3.0/5.0
Slides: 49
Provided by: faculty
Category:

less

Transcript and Presenter's Notes

Title: The Multicycle Processor II CPSC 321


1
The Multicycle Processor IICPSC 321
  • Andreas Klappenecker

2
Questions? Problems?
3
Todays Menu
  • The Multicycle Processor
  • Introduction to Verilog

4
Multicycle Approach
  • Single memory unit for instructions and data
  • Single arithmetic-logical unit
  • Registers after every major unit
  • (some visible to the programmer, some not)
  • hold output of that unit until value is used in
    next clock cycle
  • data used in subsequent instructions must be
    stored in programmer visible registers

5
Multicycle Datapath and Control Lines
6
(No Transcript)
7
(No Transcript)
8
Multicycle Datapath and Control Lines
9
Instruction Fetch/Decode/Execute
10
3rd Step R-Type Instruction
11
(No Transcript)
12
3rd Step Memory Reference InstructionsMemory
Access
13
(No Transcript)
14
4th Step Memory Reference InstructionsMemory
Address Computation
Store
15
(No Transcript)
16
What Happened So Far?
  • Single-cycle processor
  • Multi-cycle processor
  • Next
  • Pipelined processor
  • Build your own processor _at_ home!

17
Verilog
18
Levels of Abstraction
  • Specification
  • Architectural Description
  • Verilog, VHDL, ELLA or other HDLs
  • Logic Design
  • Gates and Registers
  • Circuit Design
  • Transistors sized for power and speed
  • Technology mapping
  • Layout

19
Levels of Abstraction
  • System
  • Module
  • Gate
  • Circuits
  • Device

20
MOS Transistors
  • PMOS transistor
  • like a switch
  • ON if gate is 1
  • OFF if gate is 0
  • NMOS transistor
  • OFF if gate is 1
  • ON if gate is 0

21
CMOS Circuits
  • Simple
  • Avoids difficulties
  • Resilient
  • Energy efficient
  • Current flow only during switching time

22
Circuit Design
Layout
Layering and Fabrication
23
Hardware Description Languages
  • Abstracting from circuits
  • Structural description
  • Specify full adder by NAND and NOR gates
  • Behavioral description
  • Specify full adder by functional behavior
  • Improves productivity
  • Natural for Computer Scientists

24
Verilog
  • Structural description
  • Gates, wires, input/output
  • Hierarchical description possible
  • (define full adder in terms of gates)
  • Behavioral description
  • Abstract formulation
  • Functional relationships

25
Structural Verilog Example
module mux(f, a,b,sel) output f input
a,b,sel wire f1, f2 not(nsel,
sel) and(f1, a,nsel) and(f2, b, sel) or (f,
f1, f2) endmodule
b
f
a
sel
26
Behavioral Verilog Example
  • module mux2(f, a,b,sel)
  • output f
  • input a,b,sel
  • assign f (a sel) (b sel)
  • endmodule

27
Another Example
  • module mux2(f, a,b,sel)
  • output f
  • input a,b,sel
  • reg f
  • always _at_(a or b or sel)
  • if (sel1)
  • f b
  • else
  • f a
  • endmodule

28
Synthesis
  • Compilation
  • Verilog code is translated into
  • a network of logic gates
  • Optimization
  • Try to find a better solution by logic
    optimization (limited success)
  • Technology mapping
  • Physical design

29
Logic Gates
  • and(y, a, b)
  • or(y, a, b)
  • not(y, a)
  • xor(y, a,b)
  • nand(y, a, b)

30
Modules
  • module mod_name (parameters)
  • input
  • output
  • reg
  • endmodule

31
Full Adder
  • module fulladd(cin, x, y, s, cout)
  • input cin, x, y
  • output s, cout
  • assign s x y cin
  • assign cout (x y) (cin x) (cin y)
  • endmodule

32
Full Adder
  • module fulladd(cin, x,y,s, cout)
  • input cin, x, y
  • output s, cout
  • assign cout, s x y cin
  • Endmodule
  • The assign statement sets cout to MSB and s to LSB

33
Verilog Simulators
  • vcs from Synopsis
  • powerful debugging tools
  • Icarus Verilog
  • compiler, free
  • Veriwell
  • simulator, free

34
Information about Verilog
  • Short manual
  • by Chauhan and Blair
  • Verilog Quick Reference Guide
  • by Sutherland HDL
  • Appendix A in Fundamentals of Digital Logic by
    Brown and Vranesic
  • Quick Reference for Verilog HDL
  • by Rajeev Madhavan

35
Hello World
  • module top
  • initial
  • display("Hello, world!")
  • endmodule
  • initial statements are executed once by the
    simulator

36
Verilog Simulator
  • The Verilog simulator is event driven
  • Different styles of Verilog
  • structural
  • dataflow
  • behavioral
  • We will see examples of each type

37
Nets
  • A net represents a node in the circuit
  • The wire type connects an
  • output of one element to an
  • input of another element
  • wire abar
  • not(abar, a)
  • nand(b, abar,abar)

38
Vector wires
  • Range msb lsb
  • wire 30 S
  • S 4b0011
  • The result of this assignment is
  • S3 0, S2 0, S1 1, S0 1
  • wire 12 A
  • A S21
  • means A1 S2, A2 S1

39
Variables
  • Variables come in two flavors
  • reg
  • integers
  • reg can model combinatorial or sequential parts
    of the circuits
  • reg does not necessarily denote a register!
  • Integers often used as loop control variables
  • useful for describing the behavior of a module

40
Simple Example
  • module testgate
  • reg b, c // variables
  • wire a, d, e // nets
  • and (d, b, c) // gates
  • or (e, d, c) //
  • nand(a, e, b) //
  • initial begin // simulated once
  • b1 c0 // blocking assignments
  • 10 display("a b", a)
  • end
  • endmodule What value will be printed?

41
Operators
  • 1s complement A
  • 2s complement -A
  • bitwise AND AB
  • reduction A produces AND of all bits in A
  • Concatenate a,b,c
  • a,b,c a b c
  • Replication operators 2A A,A
  • 2A,3B A,A,B,B,B

42
Continuous assignments
  • Single bit assignments
  • assign s x y cin
  • assign cout (x y) (cin x) (cin y )
  • Multibit assignments
  • wire 13 a,b,c
  • assign c a b

43
Full Adder
  • module fulladd(cin, x, y, s, cout)
  • input cin, x, y
  • output s, cout
  • assign s x y cin
  • assign cout (x y) (cin x) (cin y)
  • endmodule

44
Always Blocks
  • An always block contains one or more procedural
    statements
  • always _at_(sensitivity list)
  • always _at_(x or y)
  • begin
  • s x y
  • c x y
  • end

45
Mux Structural Verilog
module mux(f, a,b,sel) input a,b,sel
output f wire f1, f2 not(nsel, sel)
and(f1, a,nsel) and(f2, b, sel) or (f, f1,
f2) endmodule
b
f
a
sel
46
Conclusion
  • Verilog abstracts hardware
  • Modules represent hardware units
  • You can specify the behavior in
  • structural
  • dataflow-oriented
  • behavioral
  • ways.

47
Mux Dataflow Model
  • module mux2(f, a,b,sel)
  • output f
  • input a,b,sel
  • assign f (a sel) (b sel)
  • endmodule

48
Mux Behavioral Model
  • module mux2(f, a,b,sel)
  • output f
  • input a,b,sel
  • reg f
  • always _at_(a or b or sel)
  • if (sel1)
  • f b
  • else
  • f a
  • endmodule
Write a Comment
User Comments (0)
About PowerShow.com