90 likes | 247 Views
MSP430 Microarchitecture. Lab 4: MSP430 Microarchitecture. MSP430 Microarchitecture Simulator: Use the MSP430 Microarchitecture Simulator to create a Finite State Machine that implements the Texas Instruments MSP430 ISA.
E N D
MSP430 Microarchitecture Lab 4: MSP430 Microarchitecture • MSP430 Microarchitecture Simulator: • Use the MSP430 Microarchitecture Simulator to create a Finite State Machine that implements the Texas Instruments MSP430 ISA. • Create states that fetch, decode, evaluate source, evaluate destination, execute, and store MSP430 instructions and operands. • Execute a program that displays an incrementing counter in the simulator LEDs. • Learning Objectives: After completing the Microarchitecture Lab, students will be able to: • Implement a MSP430 ISA microarchitecture that executes computer instructions. • Explain how a computer is a Finite State Machine. • List 7 ways operands are accessed by a computer instruction. • Use multiplexors, decoders, drivers, ALUs, and registers to move and store data within a computer. • Explain the functions of the program counter, stack pointer, and condition code registers. • Summarize the difference between clock cycles and instruction steps. Lab 4 - Microarchitecture Lab
MSP430 Microarchitecture Microarchitecture Simulator • Simulator buttons: • Run: Generate continuous clocks • Step: Generate continuous clocks until next Fetch, Clock 1 state. • Clock: Generate one clock. • Back: Backup one clock state. • Current State: Current instruction execution state. • Next State: Next instruction state after a clock. • Reset: Reset FSM Control, registers, memory, clocks, and instructions. • Restart:Restarts current simulation. • Quit: Exit MicroArch Simulator. • Load Control: Read FSM control from a file. • Save Control: Save current control to a file. • Load Memory:Loads the currently selected program into memory. • Analyze FSM:Outputs and analysis of the FSM Control in the Notes window. • Please note: Save learned FSM Control after each instruction in a new file! Lab 4 - Microarchitecture Lab
MSP430 Microarchitecture Lab 4 Machine Code ;************************************************************** ; MSP430 Micro-Architecture Simulator Code ; ; Description: Display an incrementing counter in LEDs. ;************************************************************** .cdeclsC,"msp430.h" .text 8000: 4031 0300 RESET: mov.w #0x0300,SP ; Initstack pointer 8004: 40b2 5a80 0120 mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT 800a: d0f2 000f 001E bis.b #0x0f,&P4DIR ; Set P1.0-3 output 8010: 430e mov.w #0,r14 8012: 4ec2 001D loop: mov.b r14,&P4OUT ; output P1.0-3 8016: 531e add.w #1,r14 8018: f03e 000f and.w #0x000f,r14 ; mask counter 801c: 401f 0003 mov.w delay,r15 ; Delay to R15 8020: 120f push r15 8022: 8391 0000 wait: sub.w #1,0(sp) ; decrement delay count 8026: 23fd jne wait ; delay over? 8028: 41ef mov.w @sp+,r15 ; y 802a: 3ff3 jmp loop ; repeat 802c: 0002 delay: .word 2 .sect ".reset" ; MSP430 RESET Vector .word RESET ; NMI .end Lab 4 - Microarchitecture Lab
MSP430 Microarchitecture MSP430 Microarchitecture Simulator Lab 4 - Microarchitecture Lab
MSP430 Microarchitecture Pass-off • This lab is worth 10 points as follows: 1 point Your micro-architecture simulator executes the first instruction ("mov.w #0x0600,SP") correctly as outlined in the tutorial - a 2 word instruction with an immediate mode source operand and a register mode destination operand. 1 point Your micro-architecture simulator executes the second instruction ("mov.w#0x5a80,&WDTCTL") correctly - a three word instruction requiring three memory accesses with an absolute mode destination operand. 1 point Your micro-architecture simulator executes the third ("bis.b #0x000f,&P4DIR") and fourth ("mov.w #0,r14") instructions correctly - the fourth being an emulated instruction that uses the CG2 Constant Generator for the source operand and register mode for the destination operand. Lab 4 - Microarchitecture Lab
MSP430 Microarchitecture Pass-off 1 point Your micro-architecture simulator executes the fifth instruction ("mov.br14,&P4OUT") correctly - a two word instruction writing a register to memory. 1 point Your micro-architecture simulator executes the sixth instruction ("add.w #1,r14") correctly - another double operand emulated instruction that uses the Constant Generator CG2 for the source operand. 1 point Your micro-architecture simulator executes the seventh ("and.w#0x000f,r14") and eighth ("mov.w Delay,r15") instructions correctly - the latter requiring a PC-Relative mode for the source operand. 1 point Your micro-architecture simulator executes the ninth ("push.wr15") instruction correctly - a single operand instruction that requires the EXECUTE phase. Lab 4 - Microarchitecture Lab
MSP430 Microarchitecture Pass-off 1 point Your micro-architecture simulator executes the tenth ("sub.w #1,0x0000(SP)") instruction correctly - an emulated instruction that uses an indexed register mode for the destination operand. 1 point Your micro-architecture simulator executes the eleventh ("jne(L1)") instruction correctly - a PC-Relative jump format that does not require a source nor destination phase. 1 point Finally, your micro-architecture simulator executes the twelfth ("pop.wr15") and thirteenth ("jmp(Mainloop)") instructions correctly - the former instruction's source operand is obtained using the indexed auto-increment addressing mode "@Rs+". Lab 4 - Microarchitecture Lab
MSP430 Microarchitecture Bonus • In addition to the above points, the following bonus / deductions apply: +1 point Passed off with a TA at least one day early. (Note: labs completed in a previous semester do NOT qualify for the early pass-off bonus.) +1 point Your MSP430 micro-architecture implementation is able to turn on all four LEDs at the same time (170 instructions) in less than 919 clocks. +2 points Your MSP430 microarchitecture implementation is able execute the Bonus program and turn on all four LEDs at the same time (97 instructions) in 544 or less clocks. -1 point For each school day late. (Timestamps may be used to verify completion time.) Lab 4 - Microarchitecture Lab