Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 1 ECE 406 Design of Complex Digital Systems Lecture 11: Data Converter,

Slides:



Advertisements
Similar presentations
Chapter 5 The LC-3.
Advertisements

Chapter 5 The LC-3 Instruction Set Architecture l ISA Overview l Operate instructions l Data Movement instructions l Control Instructions l LC-3 data path.
CS25410 Memory Machine Code. Common types of non-rotating memory (1) RAMRandom Access Memory In reality, read/write memory This is usually volatile, meaning.
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 8: Sequential Design Spring 2009 W. Rhett.
Chapter 5 The LC-3.
Chapter 4 - ISA 1.The Von Neumann Model. 4-2 The Stored Program Computer 1943: ENIAC Presper Eckert and John Mauchly -- first general electronic computer.
Spring 20067W. Rhett Davis with minor modifications by Dean Brock ECE 406 at UNASlide 1 ECE 406 Design of Complex Digital Systems Lecture 10: 9: State.
LC-3 Computer LC-3 Instructions
S. Barua – CPSC 240 CHAPTER 5 THE LC-3 Topics Memory organization Registers Instruction set Opcodes.
CHAPTER 4 COMPUTER SYSTEM – Von Neumann Model
LC-3 Instruction Set Architecture (Textbook’s Chapter 5)
Chapter 5 The LC-3 LC-3 Computer Architecture Memory Map
Chapter 6 Programming in Machine Language The LC-3 Simulator
Choice for the rest of the semester New Plan –assembler and machine language –Operating systems Process scheduling Memory management File system Optimization.
Chapters 5 - The LC-3 LC-3 Computer Architecture Memory Map
LC-3 Instruction Set Architecture
Chapters 4 & 5: LC-3 Computer Architecture Machine Instructions Assembly language Programming in Machine and Assembly Language.
Overview von Neumann Model Components of a Computer Some Computer Organization Models The Computer Bus An Example Organization: The LC-3.
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 13: Regression Testing, MemAccess Block.
Computer Science 210 Computer Organization The Instruction Execution Cycle.
Chapter 5 The LC-3. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 5-2 Instruction Set Architecture ISA.
Spring 2007W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 7: Design Example,
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 19: Cache Operation & Design Spring 2009.
Spring 2007W. Rhett Davis with slight modification by Dean Brock UNCA ECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 11: Memories,
Conversion from one number base to another Equation simplification Conversion to/from SOP/POS Minimization using Karnaugh Maps Minterm and Maxterm Equations.
Spring 2007W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 2: Introduction.
Introduction to Computing Systems from bits & gates to C & beyond Chapter 5 The LC-2 Instruction Set Architecture Operate instructions Data Movement instructions.
Housekeeping 1.teams—end of class 2.Example verilog code (alter) 3.Example altera report 4.Lab Monday: you will be asked to show: -- one or more reports.
Chapter 4 The Von Neumann Model
Introduction to Computing Systems from bits & gates to C & beyond Chapter 5 The LC-3 Instruction Set Architecture ISA Overview Operate instructions Data.
Chapter 5 The LC Instruction Set Architecture ISA = All of the programmer-visible components and operations of the computer memory organization.
Chapter 5 The LC-3. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 5-2 Data Movement Instructions Load --
Introduction to Computer Engineering ECE/CS 252, Fall 2010 Prof. Mikko Lipasti Department of Electrical and Computer Engineering University of Wisconsin.
The LC-3. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 5-2 Instruction Set Architecture ISA = All of the.
Review for Final Exam LC3 – Controller FPGAs Multipliers
Chapter 5 The LC Instruction Set Architecture ISA = All of the programmer-visible components and operations of the computer memory organization.
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 7: Design Example, Modeling Flip-Flops Spring.
Spring 2007W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 12: Intro to the.
© BYU LC3-DC Page 1 ECEn 224 LC3-DC Designing The LC-3 Control IR PC enaMARMenaPC enaALU enaMDR ALU AB.
March R. Smith - University of St Thomas - Minnesota ENGR 330: Today’s Class Connecting Hardware to InstructionsConnecting Hardware to Instructions.
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 12: Intro to the LC-3 Micro-architecture.
The LC-3 – Chapter 5 COMP 2620 Dr. James Money COMP
Introduction to Computing Systems and Programming The LC-2.
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 9: State Machines & Reset Behavior Spring.
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 10: Data-Converter Example Spring 2009 W.
The LC-3 – Chapter 5 COMP 2620 Dr. James Money COMP
The LC-3 – Chapter 5 COMP 2620 Dr. James Money COMP
Computer Science 210 Computer Organization Machine Language Instructions: Control.
COSC121: Computer Systems: Review
Chapter 4 The Von Neumann Model
Computer Science 210 Computer Organization
Chapter 4 The Von Neumann Model
Computer Science 210 Computer Organization
Chapter 5 The LC-3.
The LC-3 Instruction Set Architecture Data Movement instructions
LC-3 Details and Examples
Chapter 5 The LC-3 An Hong 2018 Fall
Computer Science 210 Computer Organization
Chapter 5 The LC-3.
Computer Science 210 Computer Organization
Introduction to Computer Engineering
Computer Science 210 Computer Organization
Computer Science 210 Computer Organization
Computer Science 210 Computer Organization
Chapter 4 The Von Neumann Model
LC-2: The Little Computer 2
Dr. Juan Gómez Luna Prof. Onur Mutlu ETH Zurich Spring 2018
Chapter 4 The Von Neumann Model
Chapter 5 The LC-3.
Presentation transcript:

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 1 ECE 406 Design of Complex Digital Systems Lecture 11: Data Converter, LC-3 Instruction Set Spring W. Rhett Davis NC State University with significant material from Paul Franzon & Bill Allen

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 2 Summary of Last Lecture l How do you implement a state-machine when given a state-transition diagram? l Why in general do you need a reset-signal for a module? l What is the difference between synchronous and asynchronous reset signals?

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 3 Today’s Lecture l Data Converter Example continued l Review of the LC3 Instruction Set

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 4 Data Converter Specification l When a new 32-bit data word arrives at the input, the module stores it and then outputs the word as 4 bytes, starting with the MSB and ending with the LSB. l The arrival of a 32-bit word to be converted is signaled by a pulse on ready that is 3 clock cycles long. l The output of a byte of data is signaled by a one clock cycle pulse on new. The output byte is available during the new pulse and for one clock cycle after. Data Converter IN ready OUT new 32 / 8 /

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 5 Design Process l Step 1: Write Specification l Step 2: Draw Schematic » Ports » Registers » Datapath Logic » MUXes » Control Logic l Step 3: Write Verilog Code » Label Internal Signals » Map elements from schematic into code

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 6 Data Selector Schematic

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 7 Controller State Diagram

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 8 Data Converter (Style 1) module dataconv( input [31:0] IN, input clock, input ready, input reset, output reg [ 7:0] OUT, output reg new ); reg [31:0] value ; reg [ 3:0] state ;

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 9 Data Converter (Style 1) clock) if (reset) state <= 0 ; else case (state) 0: if (ready) state <= 1 ; else state <= 0 ; ………………

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 10 Data Converter (Style 1) clock) if (state == 1) value <= IN ; or value) case (state) 2, 4, 6, 8: new <= 1 ; default: new <= 0 ; endcase

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 11 Data Converter (Style 1) or value) case (state) 0, 1, 2, 3: OUT <= value[31:24] ; 4, 5: OUT <= value[23:16] ; 6, 7: OUT <= value[15: 8] ; default: OUT <= value[ 7: 0] ;

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 12 Data Converter (Sophisticated Style) module dataconv(IN, clock, ready, reset, OUT, new); input clock,reset,ready; input [31:0] IN; output [7:0] OUT; output new; reg [7:0] OUT; reg new; reg [31:0] value; reg [3:0] state; clock) begin if (reset) state <= 0; else case(state) 0: begin if (ready) state <= 1; else state <= 0; new <= 0; end 1: begin state <= 2; value <= IN; end 2: begin state <= 3; OUT <= value[31:24]; new <= 1; end

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 13 Data Converter (Sophisticated Style) 3: begin state <= 4; new <= 0; end 4: begin state <= 5; OUT <= value[23:16]; new <= 1; end 5: begin state <= 6; new <= 0; end 6: begin state <= 7; OUT <= value[15:8]; new <= 1; end 7: begin state <= 8; new <= 0; end 8: begin state <= 9; OUT <= value[7:0]; new <= 1; end 9: begin state <= 0; new <= 0; end default: begin state <= 0; end endcase end endmodule

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 14 Data Converter (Style 3) module dataconv( input [31:0] IN, input clock, input ready, input reset, output reg [ 7:0] OUT, output new ); // no reg reg [31:0] value ; reg inputRdy ; // ready for input reg ioAction ; // I/O occurs on next cycle reg [ 1:0] byteIndex ; // byte to output

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 15 Data Converter (Style 2) clock) if (reset) begin ioAction <= 0 ; inputRdy <= 1 ; byteIndex <= 0 ; end

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 16 Data Converter (Style 2) clock) …………………………… else if (inputRdy) begin ioAction <= !ioAction && ready ; inputRdy <= !ioAction ; byteIndex <= 0 ; end

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 17 Data Converter (Style 2) clock) …………………………… else begin ioAction <= !ioAction ; inputRdy <= ioAction && byteIndex==3 ; byteIndex <= ioAction ? byteIndex+1 : byteIndex ; end

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 18 Data Converter (Style 2) clock) if (inputRdy && ioAction) value <= IN ; assign new = ioAction && !inputRdy ;

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 19 Data Converter (Style 2) or value) case (byteIndex) 0: OUT <= value[31:24] ; 1: OUT <= value[23:16] ; 2: OUT <= value[15: 8] ; default: OUT <= value[ 7: 0] ;

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 20 Comparison of Styles l What will be the difference between the hardware synthesized from the simplified and sophisticated versions of the Data Converter code given in class?

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 21 Today’s Lecture l Data Converter Example l Review of the LC3 Instruction Set

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 22 ISA of LC3: General Info l 16-bit wide » Each word is 2-bytes wide » The memory space has 2 16 words l 8 general purpose registers l Data type: 2-complement integers l 15 instructions l Status registers: updated w/ registers » NZP

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 23 Instruction Format l Opcode » IR[15:12] l Addressing mode » Immediate (sign extension) » Register » Memory: PC relative » Memory: indirect » Memory: base+offset

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 24 ALU Operation Instructions l Also called “Operate” Instructions l AND » AND DR, SR1, SR2 (DR ← SR1 & SR2) » AND DR, SR1, Imm (DR ← SR1 & Imm) l ADD » ADD DR, SR1, SR2 (DR ← SR1 + SR2) » ADD DR, SR1, Imm (DR ← SR1 + Imm) l NOT » NOT DR, SR1 (DR ← ~SR1)

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 25 Operate Instructions l ADD l AND l NOT DR SR100 SR2 0 1 DR SR100 SR DR SR11 imm50 1 DR SR11 imm DR SR

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 26 Control Instructions l Branch » BRx Offset (PC ← PC+Offset) if any one of the specified flags is true » …where “x” is one or more Flags: (set based on the result of the last operation) –N - Negative –Z - Zero –P - Positive » Variations: » ==0 (BRZ) » !=0 (BRNP) » >0 (BRP) » >=0 (BRZP) » <0 (BRN) » <=0 (BRNZ) » Unconditional jump (BRNZP or simply BR) » Unconditional NOT jump (BRNONE)

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 27 Control Instructions l Jump » JMP BaseR (PC ← BaseR) l Ignore the other instructions for now » JSR, JSRR, RET, RTI, TRAP

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 28 Control Instructions l BR l JMP l JSR l JSRR l RET l RTI l TRAP 0 0 NZP PCoffset BaseR BaseR PCoffset Trapvect8

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 29 Data Movement Instructions l Load/Store (PC relative addressing mode) » LD DR, Offset (DR ← MEM[PC+Offset]) » ST SR, Offset (MEM[PC+Offset] ← SR) l Load/Store Register (Base+Offset addressing mode) » LDR DR, BaseR, Offset (DR ← MEM[BaseR+Offset]) » STR SR, BaseR, Offset (MEM[BaseR+Offset] ← SR)

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 30 Data Movement Instructions l Load/Store Indirect (indirect addressing mode) » LDI DR, Offset (DR ← MEM[MEM[PC+Offset]]) » STI SR, Offset (MEM[MEM[PC+Offset]] ← SR) l Load Effective Address » LEA DR, Offset (DR ← PC+Offset)

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 31 Data Movement Instructions l LD: l LDR: l LDI: l LEA: l ST: l STR: l STI: DR BaseR Offset DR PCoffset91 0 DR PCoffset DR PCoffset SR PCoffset SR PCoffset SR BaseR Offset6

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 32 Compile & Execute This Code 16’h01FFand r0, r0, #0; 16’h0200add r0, r0, #7; 16’h0201 and r1, r1, #0; 16’h0202 add r1, r1, #5; 16’h0203 add r0, r0,#-1; 16’h0204 brp #-3; 16’h0205 st r1, #2; 16’h0206 lea r6, #4; 16’h0207 jmp r6; 16’h0208 var1:; (0000) 16’h0209 var2:; (0000) 16’h020A var3:; (0000) 16’h020B …

Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 33 Finish Executing the Code 16’h0208 var1:; (0000) 16’h0209 var2:; (0000) 16’h020A var3:; (0000) 16’h020B ld r2, #-4; (25FC) 16’h020C add r2, r2, #1; (14A1) 16’h020D str r2, r6, #-2; (75BE) 16’h020E str r6, r6, #-1 ; (7DBF) 16’h020F ldi r3, #-6; (A7FA) 16’h0210 brnzp #-1; (0FFF)