COP 4600 EEL 4882 Project 2 - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

COP 4600 EEL 4882 Project 2

Description:

COP 4600 /EEL 4882. Project 2. Task. Read instruction file boot.dat, save in memory ... You should see 'If you dont get any error message,submit is successful. ... – PowerPoint PPT presentation

Number of Views:38
Avg rating:3.0/5.0
Slides: 20
Provided by: dan9154
Learn more at: http://www.cs.ucf.edu
Category:
Tags: cop | eel | dont | project

less

Transcript and Presenter's Notes

Title: COP 4600 EEL 4882 Project 2


1
COP 4600 /EEL 4882Project 2
2
Task
  • Read instruction file boot.dat, save in memory
  • Interpret and run boot.dat

3
Input
  • boot.dat
  • logon.dat (no change)
  • This time, only one logon event is there
  • Config.dat
  • CPURATE
  • How long one cpu cycle take in nanoseconds/instruc
    tion
  • MEMSIZE
  • MAXSEGMENTS

CPURATE2000 Every CPU cycle takes 2000ns
2ms SIO 75 takes 150ms to run
4
Boot.dat
  • Three parts
  • Program attribute
  • Segment attribute
  • Instructions
  • Project 2
  • Only one program boot

Program 1
Segment 1
Segment 2
Program 2
Segment 1
Segment 2
Segment 3
Segment 4
Memory Layout
5
Boot.dat
Program has 4 segments
segment table. Load into MEMMAP Segment
length Segment access bit
one segment
Input file boot.dat
6
Output
  • Memory layout (boot.dat) (30 of work)
  • Event generated when running boot (70 of work)

7
Program Skeleton
In simulator.c Main() Boot() //
Load boot.dat into memory, print out memory
layout while( new_events ! NULL )
Interrupt() // take out one
event, print it out (consume one event)
XPGM( .) // Simulate a cpu cycle
(generate one event)
8
Memory Structure
  • Array MEM is your memory
  • From simulator.c
  • struct instr_type MEM
  • MEM calloc(MEMSIZE, sizeof(struct instr_type))
  • Array MEMMAP is your segment table
  • From simulator.c
  • struct segment_type MEMMAP
  • MEMMAP calloc(2MAXSEGMENTS, sizeof(struct
    segment_type))

9
Memory Structure
0
SIO 75
1
DISK 2000
SKIP 0
2
3
JUMP 2,0
4
SKIP 1
Boot.Seg1
0
JUMP 3,0
5
6
SKIP 0
Boot.Seg2
1
JUMP 2,6
7
Boot.Seg3
2
8
SIO 400
Boot.Seg4
3
PRNT 150
9
10
WIO 500
MEMMAP
REQ 0,1
11
12
WIO 0
REQ 2,1
13
14
SKIP 0
JUMP 1,0
15
END 20
16
MEM
10
Instruction Set
  • SIO n
  • CPU burst for n cycles
  • Start IO
  • WIO n
  • CPU burst for n cycles
  • Wait IO (block)
  • END n
  • CPU burst for n cycles
  • End program

11
Instruction Set
  • Device n
  • Always follows SIO
  • n is the bytes transferred (used to calculate
    time needed)
  • Device can be DISK, PRNT
  • Sample
  • SIO 75
  • DISK 2000
  • REQ seg, off
  • Always follows WIO
  • seg, off refers to the device instruction
    waiting for
  • Sample
  • 2, 1 PRNT 150
  • WIO 0
  • REQ 2,1

12
Instruction Set
  • JUMP seg, off
  • Jump to seg, off
  • SKIP n
  • Skip the next instruction for n times
  • Sample
  • SKIP 1
  • JUMP 3,0
  • SIO 400

13
Functions
  • Boot
  • Get_Instr // Read one instruction from boot.dat
  • Display_pgm // display memory layout
  • XPGM
  • CPU // One CPU cycle
  • Fetch // Read one instruction from memory
  • Util
  • Read
  • Write // Write one instruction to memory
  • Mu // convert seg, off to physical memory

14
CPU
  • Every invocation of CPU() will execute one CPU
    burst instruction
  • SIO/WIO/END
  • SKIP
  • Skip or continue to next instruction
  • Jump
  • Jump to destination and continue
  • SIO
  • Skip the next instruction (device)
  • WIO
  • Skip the next instruction (req)

15
Events
  • For every CPU invocation
  • Run one CPU burst, SIO/WIO/END
  • Generate one event of type SIO/WIO/END
  • Timestamp the finish time of CPU burst

0,0
SIO 75 DISK 2000
SIO, 150ms
0,2
SKIP 0 JUMP 2,0 SIO 400 PRNT 150
SIO, 950ms
950ms 150ms 400(cpu burst)2000ns 950ms
2,0
Events
CPU() invocations
16
Events
  • Ignore device related operations in project 2
  • Device instructions (disk, prnt)
  • Req instructions

17
Develop process
  • Make copyfiles
  • Make data2files
  • Modify obj2.c
  • Reuse obj1.c, you may need to modify obj1.c
  • Make sim, then run sim
  • Make compare OBJ2
  • If error happens, manually check data2.out and
    ossim.out, see what is wrong
  • You should expect Done. Looks OK to me...
  • Make submit
  • You should see If you dont get any error
    message,submit is successful.

18
Segment Fault
  • You can use gdb to debug
  • gdb sim
  • (gdb)run
  • segment fault
  • (gdb)bt
  • Now you can see which line cause the error
  • More gdb command
  • b obj2.c87 // stop at obj2.c, line 87
  • next // run next instruction
  • p new_events // print out variable new_events
  • cont // continue to execute the program

19
Deadline
  • Deadline is Feb 15 (Friday) midnight
  • Late assignments are accepted five days after the
    due date with a penalty of 20 off. After five
    days, assignments will not be accepted. The grade
    for those assignments will be zero.
Write a Comment
User Comments (0)
About PowerShow.com