DOC PREVIEW
UCSD CSE 141L - Project 1 Part B

This preview shows page 1-2-3 out of 8 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Project(1(Part(B:(Assemble(and(Simulate(CSE(141L,(Fall(2008,(Richard(Strong(Due:(October(27,(2008(@(11:59pm(You(are(encouraged(to(work(on(this(project(in(teams(of(2.(!Overview(Although!you!have!already!designed!an!ISA,!you!need!to!validate!and !revi se!the!ISA!before!expending!the!extensive!effort!required!to!sign!and !implem ent!it.!In!project!1b,!you! will! implement!t wo!essential !components!for!arc hitectural!validation!and!verification‐!ass embler!and!simulator.!An!assembler!translates!y our!program !written! in!your!ISA!into!binary!code;!a!simulator! performs!a!simulation!upon!a!provided!binary!code.!Collectively,!t hey!form!essenti al!infrastructure!for!your!processor!design.!For!the!implementation!of! the!assembler!and!the!simulator, !you !are! free!to!choose!any!high!level!language!(including!scrip ting!languages).! !Assembler(It!is!difficul t!and!error‐prone!to!manuall y!write!machine! code.!To!address!this!problem,!peopl e!usually!use!an!assembler,!which!automatically!generates!a!machine!code!fro m!an!assembly!file.!Moreove r,!ma ny!C !compilers!fi rst!generate!asse mbly!files!and!then!simp ly!fe ed!it!to!an!assembler!to!get!the!executable!machine!code.!For!these!reasons,!you!should !write!an!assembler!for!your!ISA.!Your!assembler!reads!a!progr am!written!in!an !assembly!language,!then!translates!it!into!binary!cod e!an d!generates!two!output!files!c ontaining!ex ecutable!ma chine!code.!You! will! use!the!generate d!output!files!for!both!the!simulator!and!the!actual!hardware!you!will!implement.!Required(Features(First,!examine!the!following!sample!assembly!code.!.text!!!!!!!!!la!!$ 1,!table0!!!!//!load!the!address!of!a!label!table0!(pseudo !instruction)!!!!!!!!!lw!!$2,!$1!!!!!!!!//!$2!<=!0x000C0FFEE!!!!!!!!!!lw!!$3,!table0!!!!//!load!the!va lue!at!label!table0!(pseud o!instruction),!$3!<=!0x000C0FFEE!!!!!!!!!lw!!$4,!3(table0)!//!$4!<=!table1!!!!!!!!!lw!!$5,!1($4)!!!!!//!$5!<=!0x1DEADBEEF!!!!!!!!!sw!!$5,!1( $1)!!!!!//!0x001COFFEE!is!overwritten!to!0x1DE ADBEEF!!!!!!!!!!li!!$6,!0xC0FFE E!!//!load!immediate!(pseudo!instruction),!$6!<=!0xC0FFEE!!!!!!!!!!.data!!!!table0:!!!!!!!!!.word!0x000C0FFEE !!!!!!!!!.word!0x001C0FFEE !!!!!!!!!.word!0x002C0FFEE !!!!!!!!!.word!table1!!!!table1:!!!!!!!!!.word!0x0DEADBEEF!!!!!!!!!.word!0x1DEADBEEF!!!!!!!!!.word!0x2DEADBEEF!!!!!!!!!.word!0x3DEADBEEF!!!!!!!!!.word!0x4DEADBEEF,!0x5DEADBEEF,!0x6DEADBEEF!!!!!!!!!.fill!10!0x0!!Your!as sembler!must!support!the!following!keywords!and!reserved!words !used!in! the!example !cod e!above.! The! following!list!is!t he!minimal!required !set;!you !may!ext end!it!with!other!key words.!• .text!!Indicates!the!start!of!the!text!section,!co nsisting!of!instructions.!.text!can!appear!many!times! in!an!asse mbly!file,!but!they!must!be!merged!into!a!single!section!in!the!out put!of!the!assembler .!The!input!to!the!assembler!(‐text_addr)!will!specify!the!address!that!the!asse mbler!will!assume!the!resulting!text!se ction!is!loaded!a t.!• .data!!Indicates!the!start!of!the!data!sectio n.!Similar!to!.text,!there!can!be!multi ple!.data!in!an!assembly!file.!T he!input!to!t he!a ssembler!(‐data_addr)!will!specify!th e!ad dres s!that!the!assembler!will!assume!the!resulting!data!section!is !loaded!at.!• .word!!Specifies!the!word!data!at!a !memory!loc ation.!It!can!be!followed!by!multiple!one!or!more!words!to!describe!data!for !multiple!words.!• .fill !!Duplicates!a!da ta!many!times.!F or!example,!.fill-10-0x0!duplicates!0x0!ten!times.!• lab el:!!Represents!an!instruction!or!data!memory!address,!similar!to!labels!in!other!l anguage s,!ca n!be!used!in !inst ructions!to!speci fy!a!specific!address!(e.g.!la!$0,!table0).!When!you!use!labels,!you!can!minimi ze!the!amount!of!ma nual!mo difications!in!your!assembly!code!upon!insertions!or!del etions!of!instructions!and/or!data.!For!example,!s uppose!that!.word-0x003COFFEE!is!insterted!after!.word-0x002C0FFEE!in!the!previous!sample!code;!the!only!need ed!change!is!the!fourth!instruction!from!lw-$4,-3(table0)!to!lw-$4, -4(table).!In!other!words,!labels!make!the !cod e!ma intenance!cost!more!manageable!by!keeping!the!effect!of!a!code!modification!be!local!to!a!lab el.!In!addition!to!the!keywords!listed!above,!the!assembler!must!support!at!least!four!pseudo!instructions!equivalent!to!the!following!MIPS!pseudo!instructions!appeared!in!the!previous!example!code.!• la/$rd,/offset(label)!!Loads!the!a ddress!o f!(label!+!offset)! into!$rd.!• lw/$rd,/offs et(label)!!Loads!the!data!located!at!(label!+!offset)!into!$rd.!• li/$rd,/immediate!!Loads!the!immediate!value!into!$rd.!• sw/$rs,/offs et(label)!!Stores!the!value!of!$rs!to!the!address!(label!+!off set).!These!pseudo!instructions!will!make!programmers'!life!easier!by!allowing!programmers!not!to!concern!absolute!addresses;!instead ,!they!can!describe!most!addresses!with!label !and!offset.!Note!that!pseudo!instructions!might!be!equivalent!to!multiple!instructions!in!your!ISA.!Also!note!that!the!addre sses!used!in!pseu do!instructions!can!be!either!an!i nstruction!memory!addr ess!or!a!data !memory!address!depending!on!the!location!of!th e!label.!You! may !change!pseudo!instr uction!n ames!if!needed,!but!the!semantics!of!instructions!should!be!the!same.!Code(Stub(To!execute! a!be nchmark!in!your!simulator,!you!will!need!to!c reat e!a!small!code!st ub!that!sets!up!the!environment,!including:!• Stack(Pointer!Make!sure!that!the!stack!pointer!is!properly!set!so!that!the!tested!function!(benchmark)!can!use!the!stack.!• Global(Pointer!A!program!often!accesses!global!data!and/or!constants!by!using!the!global!pointer!($gp!in!MIPS),!which!is!also!set!by!the!code!stub.!Like!the!stack!pointer,!a!code!stub!should!properly!set!the!global!pointer!before!the!execution!of!a!tested!function.!•


View Full Document

UCSD CSE 141L - Project 1 Part B

Download Project 1 Part B
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Project 1 Part B and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Project 1 Part B 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?