nios2_uc_nios2_cpu.v 195 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750
  1. //Legal Notice: (C)2020 Altera Corporation. All rights reserved. Your
  2. //use of Altera Corporation's design tools, logic functions and other
  3. //software and tools, and its AMPP partner logic functions, and any
  4. //output files any of the foregoing (including device programming or
  5. //simulation files), and any associated documentation or information are
  6. //expressly subject to the terms and conditions of the Altera Program
  7. //License Subscription Agreement or other applicable license agreement,
  8. //including, without limitation, that your use is for the sole purpose
  9. //of programming logic devices manufactured by Altera and sold by Altera
  10. //or its authorized distributors. Please refer to the applicable
  11. //agreement for further details.
  12. // synthesis translate_off
  13. `timescale 1ns / 1ps
  14. // synthesis translate_on
  15. // turn off superfluous verilog processor warnings
  16. // altera message_level Level1
  17. // altera message_off 10034 10035 10036 10037 10230 10240 10030
  18. module nios2_uc_nios2_cpu_register_bank_a_module (
  19. // inputs:
  20. clock,
  21. data,
  22. rdaddress,
  23. wraddress,
  24. wren,
  25. // outputs:
  26. q
  27. )
  28. ;
  29. parameter lpm_file = "UNUSED";
  30. output [ 31: 0] q;
  31. input clock;
  32. input [ 31: 0] data;
  33. input [ 4: 0] rdaddress;
  34. input [ 4: 0] wraddress;
  35. input wren;
  36. wire [ 31: 0] q;
  37. wire [ 31: 0] ram_data;
  38. wire [ 31: 0] ram_q;
  39. assign q = ram_q;
  40. assign ram_data = data;
  41. altsyncram the_altsyncram
  42. (
  43. .address_a (wraddress),
  44. .address_b (rdaddress),
  45. .clock0 (clock),
  46. .data_a (ram_data),
  47. .q_b (ram_q),
  48. .wren_a (wren)
  49. );
  50. defparam the_altsyncram.address_reg_b = "CLOCK0",
  51. the_altsyncram.init_file = lpm_file,
  52. the_altsyncram.maximum_depth = 0,
  53. the_altsyncram.numwords_a = 32,
  54. the_altsyncram.numwords_b = 32,
  55. the_altsyncram.operation_mode = "DUAL_PORT",
  56. the_altsyncram.outdata_reg_b = "UNREGISTERED",
  57. the_altsyncram.ram_block_type = "AUTO",
  58. the_altsyncram.rdcontrol_reg_b = "CLOCK0",
  59. the_altsyncram.read_during_write_mode_mixed_ports = "DONT_CARE",
  60. the_altsyncram.width_a = 32,
  61. the_altsyncram.width_b = 32,
  62. the_altsyncram.widthad_a = 5,
  63. the_altsyncram.widthad_b = 5;
  64. endmodule
  65. // synthesis translate_off
  66. `timescale 1ns / 1ps
  67. // synthesis translate_on
  68. // turn off superfluous verilog processor warnings
  69. // altera message_level Level1
  70. // altera message_off 10034 10035 10036 10037 10230 10240 10030
  71. module nios2_uc_nios2_cpu_register_bank_b_module (
  72. // inputs:
  73. clock,
  74. data,
  75. rdaddress,
  76. wraddress,
  77. wren,
  78. // outputs:
  79. q
  80. )
  81. ;
  82. parameter lpm_file = "UNUSED";
  83. output [ 31: 0] q;
  84. input clock;
  85. input [ 31: 0] data;
  86. input [ 4: 0] rdaddress;
  87. input [ 4: 0] wraddress;
  88. input wren;
  89. wire [ 31: 0] q;
  90. wire [ 31: 0] ram_data;
  91. wire [ 31: 0] ram_q;
  92. assign q = ram_q;
  93. assign ram_data = data;
  94. altsyncram the_altsyncram
  95. (
  96. .address_a (wraddress),
  97. .address_b (rdaddress),
  98. .clock0 (clock),
  99. .data_a (ram_data),
  100. .q_b (ram_q),
  101. .wren_a (wren)
  102. );
  103. defparam the_altsyncram.address_reg_b = "CLOCK0",
  104. the_altsyncram.init_file = lpm_file,
  105. the_altsyncram.maximum_depth = 0,
  106. the_altsyncram.numwords_a = 32,
  107. the_altsyncram.numwords_b = 32,
  108. the_altsyncram.operation_mode = "DUAL_PORT",
  109. the_altsyncram.outdata_reg_b = "UNREGISTERED",
  110. the_altsyncram.ram_block_type = "AUTO",
  111. the_altsyncram.rdcontrol_reg_b = "CLOCK0",
  112. the_altsyncram.read_during_write_mode_mixed_ports = "DONT_CARE",
  113. the_altsyncram.width_a = 32,
  114. the_altsyncram.width_b = 32,
  115. the_altsyncram.widthad_a = 5,
  116. the_altsyncram.widthad_b = 5;
  117. endmodule
  118. // synthesis translate_off
  119. `timescale 1ns / 1ps
  120. // synthesis translate_on
  121. // turn off superfluous verilog processor warnings
  122. // altera message_level Level1
  123. // altera message_off 10034 10035 10036 10037 10230 10240 10030
  124. module nios2_uc_nios2_cpu_nios2_oci_debug (
  125. // inputs:
  126. clk,
  127. dbrk_break,
  128. debugreq,
  129. hbreak_enabled,
  130. jdo,
  131. jrst_n,
  132. ocireg_ers,
  133. ocireg_mrs,
  134. reset,
  135. st_ready_test_idle,
  136. take_action_ocimem_a,
  137. take_action_ocireg,
  138. xbrk_break,
  139. // outputs:
  140. debugack,
  141. monitor_error,
  142. monitor_go,
  143. monitor_ready,
  144. oci_hbreak_req,
  145. resetlatch,
  146. resetrequest
  147. )
  148. ;
  149. output debugack;
  150. output monitor_error;
  151. output monitor_go;
  152. output monitor_ready;
  153. output oci_hbreak_req;
  154. output resetlatch;
  155. output resetrequest;
  156. input clk;
  157. input dbrk_break;
  158. input debugreq;
  159. input hbreak_enabled;
  160. input [ 37: 0] jdo;
  161. input jrst_n;
  162. input ocireg_ers;
  163. input ocireg_mrs;
  164. input reset;
  165. input st_ready_test_idle;
  166. input take_action_ocimem_a;
  167. input take_action_ocireg;
  168. input xbrk_break;
  169. reg break_on_reset /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,R101\"" */;
  170. wire debugack;
  171. reg jtag_break /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,R101\"" */;
  172. reg monitor_error /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=D101" */;
  173. reg monitor_go /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=D101" */;
  174. reg monitor_ready /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=D101" */;
  175. wire oci_hbreak_req;
  176. wire reset_sync;
  177. reg resetlatch /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,R101\"" */;
  178. reg resetrequest /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,R101\"" */;
  179. wire unxcomplemented_resetxx0;
  180. assign unxcomplemented_resetxx0 = jrst_n;
  181. altera_std_synchronizer the_altera_std_synchronizer
  182. (
  183. .clk (clk),
  184. .din (reset),
  185. .dout (reset_sync),
  186. .reset_n (unxcomplemented_resetxx0)
  187. );
  188. defparam the_altera_std_synchronizer.depth = 2;
  189. always @(posedge clk or negedge jrst_n)
  190. begin
  191. if (jrst_n == 0)
  192. begin
  193. resetrequest <= 1'b0;
  194. break_on_reset <= 1'b0;
  195. jtag_break <= 1'b0;
  196. end
  197. else if (take_action_ocimem_a)
  198. begin
  199. resetrequest <= jdo[22];
  200. jtag_break <= jdo[21] ? 1
  201. : jdo[20] ? 0
  202. : jtag_break;
  203. break_on_reset <= jdo[19] ? 1
  204. : jdo[18] ? 0
  205. : break_on_reset;
  206. resetlatch <= jdo[24] ? 0 : resetlatch;
  207. end
  208. else if (reset_sync)
  209. begin
  210. jtag_break <= break_on_reset;
  211. resetlatch <= 1;
  212. end
  213. else if (debugreq & ~debugack & break_on_reset)
  214. jtag_break <= 1'b1;
  215. end
  216. always @(posedge clk or negedge jrst_n)
  217. begin
  218. if (jrst_n == 0)
  219. begin
  220. monitor_ready <= 1'b0;
  221. monitor_error <= 1'b0;
  222. monitor_go <= 1'b0;
  223. end
  224. else
  225. begin
  226. if (take_action_ocimem_a && jdo[25])
  227. monitor_ready <= 1'b0;
  228. else if (take_action_ocireg && ocireg_mrs)
  229. monitor_ready <= 1'b1;
  230. if (take_action_ocimem_a && jdo[25])
  231. monitor_error <= 1'b0;
  232. else if (take_action_ocireg && ocireg_ers)
  233. monitor_error <= 1'b1;
  234. if (take_action_ocimem_a && jdo[23])
  235. monitor_go <= 1'b1;
  236. else if (st_ready_test_idle)
  237. monitor_go <= 1'b0;
  238. end
  239. end
  240. assign oci_hbreak_req = jtag_break | dbrk_break | xbrk_break | debugreq;
  241. assign debugack = ~hbreak_enabled;
  242. endmodule
  243. // synthesis translate_off
  244. `timescale 1ns / 1ps
  245. // synthesis translate_on
  246. // turn off superfluous verilog processor warnings
  247. // altera message_level Level1
  248. // altera message_off 10034 10035 10036 10037 10230 10240 10030
  249. module nios2_uc_nios2_cpu_nios2_oci_break (
  250. // inputs:
  251. clk,
  252. dbrk_break,
  253. dbrk_goto0,
  254. dbrk_goto1,
  255. jdo,
  256. jrst_n,
  257. take_action_break_a,
  258. take_action_break_b,
  259. take_action_break_c,
  260. take_no_action_break_a,
  261. take_no_action_break_b,
  262. take_no_action_break_c,
  263. xbrk_goto0,
  264. xbrk_goto1,
  265. // outputs:
  266. break_readreg,
  267. dbrk_hit0_latch,
  268. dbrk_hit1_latch,
  269. dbrk_hit2_latch,
  270. dbrk_hit3_latch,
  271. trigbrktype,
  272. trigger_state_0,
  273. trigger_state_1,
  274. xbrk_ctrl0,
  275. xbrk_ctrl1,
  276. xbrk_ctrl2,
  277. xbrk_ctrl3
  278. )
  279. ;
  280. output [ 31: 0] break_readreg;
  281. output dbrk_hit0_latch;
  282. output dbrk_hit1_latch;
  283. output dbrk_hit2_latch;
  284. output dbrk_hit3_latch;
  285. output trigbrktype;
  286. output trigger_state_0;
  287. output trigger_state_1;
  288. output [ 7: 0] xbrk_ctrl0;
  289. output [ 7: 0] xbrk_ctrl1;
  290. output [ 7: 0] xbrk_ctrl2;
  291. output [ 7: 0] xbrk_ctrl3;
  292. input clk;
  293. input dbrk_break;
  294. input dbrk_goto0;
  295. input dbrk_goto1;
  296. input [ 37: 0] jdo;
  297. input jrst_n;
  298. input take_action_break_a;
  299. input take_action_break_b;
  300. input take_action_break_c;
  301. input take_no_action_break_a;
  302. input take_no_action_break_b;
  303. input take_no_action_break_c;
  304. input xbrk_goto0;
  305. input xbrk_goto1;
  306. wire [ 3: 0] break_a_wpr;
  307. wire [ 1: 0] break_a_wpr_high_bits;
  308. wire [ 1: 0] break_a_wpr_low_bits;
  309. wire [ 1: 0] break_b_rr;
  310. wire [ 1: 0] break_c_rr;
  311. reg [ 31: 0] break_readreg /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,R101\"" */;
  312. wire dbrk0_high_value;
  313. wire dbrk0_low_value;
  314. wire dbrk1_high_value;
  315. wire dbrk1_low_value;
  316. wire dbrk2_high_value;
  317. wire dbrk2_low_value;
  318. wire dbrk3_high_value;
  319. wire dbrk3_low_value;
  320. wire dbrk_hit0_latch;
  321. wire dbrk_hit1_latch;
  322. wire dbrk_hit2_latch;
  323. wire dbrk_hit3_latch;
  324. wire take_action_any_break;
  325. reg trigbrktype /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,R101\"" */;
  326. reg trigger_state;
  327. wire trigger_state_0;
  328. wire trigger_state_1;
  329. wire [ 31: 0] xbrk0_value;
  330. wire [ 31: 0] xbrk1_value;
  331. wire [ 31: 0] xbrk2_value;
  332. wire [ 31: 0] xbrk3_value;
  333. reg [ 7: 0] xbrk_ctrl0 /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,R101\"" */;
  334. reg [ 7: 0] xbrk_ctrl1 /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,R101\"" */;
  335. reg [ 7: 0] xbrk_ctrl2 /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,R101\"" */;
  336. reg [ 7: 0] xbrk_ctrl3 /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,R101\"" */;
  337. assign break_a_wpr = jdo[35 : 32];
  338. assign break_a_wpr_high_bits = break_a_wpr[3 : 2];
  339. assign break_a_wpr_low_bits = break_a_wpr[1 : 0];
  340. assign break_b_rr = jdo[33 : 32];
  341. assign break_c_rr = jdo[33 : 32];
  342. assign take_action_any_break = take_action_break_a | take_action_break_b | take_action_break_c;
  343. always @(posedge clk or negedge jrst_n)
  344. begin
  345. if (jrst_n == 0)
  346. begin
  347. xbrk_ctrl0 <= 0;
  348. xbrk_ctrl1 <= 0;
  349. xbrk_ctrl2 <= 0;
  350. xbrk_ctrl3 <= 0;
  351. trigbrktype <= 0;
  352. end
  353. else
  354. begin
  355. if (take_action_any_break)
  356. trigbrktype <= 0;
  357. else if (dbrk_break)
  358. trigbrktype <= 1;
  359. if (take_action_break_b)
  360. begin
  361. if ((break_b_rr == 2'b00) && (0 >= 1))
  362. begin
  363. xbrk_ctrl0[0] <= jdo[27];
  364. xbrk_ctrl0[1] <= jdo[28];
  365. xbrk_ctrl0[2] <= jdo[29];
  366. xbrk_ctrl0[3] <= jdo[30];
  367. xbrk_ctrl0[4] <= jdo[21];
  368. xbrk_ctrl0[5] <= jdo[20];
  369. xbrk_ctrl0[6] <= jdo[19];
  370. xbrk_ctrl0[7] <= jdo[18];
  371. end
  372. if ((break_b_rr == 2'b01) && (0 >= 2))
  373. begin
  374. xbrk_ctrl1[0] <= jdo[27];
  375. xbrk_ctrl1[1] <= jdo[28];
  376. xbrk_ctrl1[2] <= jdo[29];
  377. xbrk_ctrl1[3] <= jdo[30];
  378. xbrk_ctrl1[4] <= jdo[21];
  379. xbrk_ctrl1[5] <= jdo[20];
  380. xbrk_ctrl1[6] <= jdo[19];
  381. xbrk_ctrl1[7] <= jdo[18];
  382. end
  383. if ((break_b_rr == 2'b10) && (0 >= 3))
  384. begin
  385. xbrk_ctrl2[0] <= jdo[27];
  386. xbrk_ctrl2[1] <= jdo[28];
  387. xbrk_ctrl2[2] <= jdo[29];
  388. xbrk_ctrl2[3] <= jdo[30];
  389. xbrk_ctrl2[4] <= jdo[21];
  390. xbrk_ctrl2[5] <= jdo[20];
  391. xbrk_ctrl2[6] <= jdo[19];
  392. xbrk_ctrl2[7] <= jdo[18];
  393. end
  394. if ((break_b_rr == 2'b11) && (0 >= 4))
  395. begin
  396. xbrk_ctrl3[0] <= jdo[27];
  397. xbrk_ctrl3[1] <= jdo[28];
  398. xbrk_ctrl3[2] <= jdo[29];
  399. xbrk_ctrl3[3] <= jdo[30];
  400. xbrk_ctrl3[4] <= jdo[21];
  401. xbrk_ctrl3[5] <= jdo[20];
  402. xbrk_ctrl3[6] <= jdo[19];
  403. xbrk_ctrl3[7] <= jdo[18];
  404. end
  405. end
  406. end
  407. end
  408. assign dbrk_hit0_latch = 1'b0;
  409. assign dbrk0_low_value = 0;
  410. assign dbrk0_high_value = 0;
  411. assign dbrk_hit1_latch = 1'b0;
  412. assign dbrk1_low_value = 0;
  413. assign dbrk1_high_value = 0;
  414. assign dbrk_hit2_latch = 1'b0;
  415. assign dbrk2_low_value = 0;
  416. assign dbrk2_high_value = 0;
  417. assign dbrk_hit3_latch = 1'b0;
  418. assign dbrk3_low_value = 0;
  419. assign dbrk3_high_value = 0;
  420. assign xbrk0_value = 32'b0;
  421. assign xbrk1_value = 32'b0;
  422. assign xbrk2_value = 32'b0;
  423. assign xbrk3_value = 32'b0;
  424. always @(posedge clk or negedge jrst_n)
  425. begin
  426. if (jrst_n == 0)
  427. break_readreg <= 32'b0;
  428. else if (take_action_any_break)
  429. break_readreg <= jdo[31 : 0];
  430. else if (take_no_action_break_a)
  431. case (break_a_wpr_high_bits)
  432. 2'd0: begin
  433. case (break_a_wpr_low_bits) // synthesis full_case
  434. 2'd0: begin
  435. break_readreg <= xbrk0_value;
  436. end // 2'd0
  437. 2'd1: begin
  438. break_readreg <= xbrk1_value;
  439. end // 2'd1
  440. 2'd2: begin
  441. break_readreg <= xbrk2_value;
  442. end // 2'd2
  443. 2'd3: begin
  444. break_readreg <= xbrk3_value;
  445. end // 2'd3
  446. endcase // break_a_wpr_low_bits
  447. end // 2'd0
  448. 2'd1: begin
  449. break_readreg <= 32'b0;
  450. end // 2'd1
  451. 2'd2: begin
  452. case (break_a_wpr_low_bits) // synthesis full_case
  453. 2'd0: begin
  454. break_readreg <= dbrk0_low_value;
  455. end // 2'd0
  456. 2'd1: begin
  457. break_readreg <= dbrk1_low_value;
  458. end // 2'd1
  459. 2'd2: begin
  460. break_readreg <= dbrk2_low_value;
  461. end // 2'd2
  462. 2'd3: begin
  463. break_readreg <= dbrk3_low_value;
  464. end // 2'd3
  465. endcase // break_a_wpr_low_bits
  466. end // 2'd2
  467. 2'd3: begin
  468. case (break_a_wpr_low_bits) // synthesis full_case
  469. 2'd0: begin
  470. break_readreg <= dbrk0_high_value;
  471. end // 2'd0
  472. 2'd1: begin
  473. break_readreg <= dbrk1_high_value;
  474. end // 2'd1
  475. 2'd2: begin
  476. break_readreg <= dbrk2_high_value;
  477. end // 2'd2
  478. 2'd3: begin
  479. break_readreg <= dbrk3_high_value;
  480. end // 2'd3
  481. endcase // break_a_wpr_low_bits
  482. end // 2'd3
  483. endcase // break_a_wpr_high_bits
  484. else if (take_no_action_break_b)
  485. break_readreg <= jdo[31 : 0];
  486. else if (take_no_action_break_c)
  487. break_readreg <= jdo[31 : 0];
  488. end
  489. always @(posedge clk or negedge jrst_n)
  490. begin
  491. if (jrst_n == 0)
  492. trigger_state <= 0;
  493. else if (trigger_state_1 & (xbrk_goto0 | dbrk_goto0))
  494. trigger_state <= 0;
  495. else if (trigger_state_0 & (xbrk_goto1 | dbrk_goto1))
  496. trigger_state <= -1;
  497. end
  498. assign trigger_state_0 = ~trigger_state;
  499. assign trigger_state_1 = trigger_state;
  500. endmodule
  501. // synthesis translate_off
  502. `timescale 1ns / 1ps
  503. // synthesis translate_on
  504. // turn off superfluous verilog processor warnings
  505. // altera message_level Level1
  506. // altera message_off 10034 10035 10036 10037 10230 10240 10030
  507. module nios2_uc_nios2_cpu_nios2_oci_xbrk (
  508. // inputs:
  509. D_valid,
  510. E_valid,
  511. F_pc,
  512. clk,
  513. reset_n,
  514. trigger_state_0,
  515. trigger_state_1,
  516. xbrk_ctrl0,
  517. xbrk_ctrl1,
  518. xbrk_ctrl2,
  519. xbrk_ctrl3,
  520. // outputs:
  521. xbrk_break,
  522. xbrk_goto0,
  523. xbrk_goto1,
  524. xbrk_traceoff,
  525. xbrk_traceon,
  526. xbrk_trigout
  527. )
  528. ;
  529. output xbrk_break;
  530. output xbrk_goto0;
  531. output xbrk_goto1;
  532. output xbrk_traceoff;
  533. output xbrk_traceon;
  534. output xbrk_trigout;
  535. input D_valid;
  536. input E_valid;
  537. input [ 17: 0] F_pc;
  538. input clk;
  539. input reset_n;
  540. input trigger_state_0;
  541. input trigger_state_1;
  542. input [ 7: 0] xbrk_ctrl0;
  543. input [ 7: 0] xbrk_ctrl1;
  544. input [ 7: 0] xbrk_ctrl2;
  545. input [ 7: 0] xbrk_ctrl3;
  546. wire D_cpu_addr_en;
  547. wire E_cpu_addr_en;
  548. reg E_xbrk_goto0;
  549. reg E_xbrk_goto1;
  550. reg E_xbrk_traceoff;
  551. reg E_xbrk_traceon;
  552. reg E_xbrk_trigout;
  553. wire [ 19: 0] cpu_i_address;
  554. wire xbrk0_armed;
  555. wire xbrk0_break_hit;
  556. wire xbrk0_goto0_hit;
  557. wire xbrk0_goto1_hit;
  558. wire xbrk0_toff_hit;
  559. wire xbrk0_ton_hit;
  560. wire xbrk0_tout_hit;
  561. wire xbrk1_armed;
  562. wire xbrk1_break_hit;
  563. wire xbrk1_goto0_hit;
  564. wire xbrk1_goto1_hit;
  565. wire xbrk1_toff_hit;
  566. wire xbrk1_ton_hit;
  567. wire xbrk1_tout_hit;
  568. wire xbrk2_armed;
  569. wire xbrk2_break_hit;
  570. wire xbrk2_goto0_hit;
  571. wire xbrk2_goto1_hit;
  572. wire xbrk2_toff_hit;
  573. wire xbrk2_ton_hit;
  574. wire xbrk2_tout_hit;
  575. wire xbrk3_armed;
  576. wire xbrk3_break_hit;
  577. wire xbrk3_goto0_hit;
  578. wire xbrk3_goto1_hit;
  579. wire xbrk3_toff_hit;
  580. wire xbrk3_ton_hit;
  581. wire xbrk3_tout_hit;
  582. reg xbrk_break;
  583. wire xbrk_break_hit;
  584. wire xbrk_goto0;
  585. wire xbrk_goto0_hit;
  586. wire xbrk_goto1;
  587. wire xbrk_goto1_hit;
  588. wire xbrk_toff_hit;
  589. wire xbrk_ton_hit;
  590. wire xbrk_tout_hit;
  591. wire xbrk_traceoff;
  592. wire xbrk_traceon;
  593. wire xbrk_trigout;
  594. assign cpu_i_address = {F_pc, 2'b00};
  595. assign D_cpu_addr_en = D_valid;
  596. assign E_cpu_addr_en = E_valid;
  597. assign xbrk0_break_hit = 0;
  598. assign xbrk0_ton_hit = 0;
  599. assign xbrk0_toff_hit = 0;
  600. assign xbrk0_tout_hit = 0;
  601. assign xbrk0_goto0_hit = 0;
  602. assign xbrk0_goto1_hit = 0;
  603. assign xbrk1_break_hit = 0;
  604. assign xbrk1_ton_hit = 0;
  605. assign xbrk1_toff_hit = 0;
  606. assign xbrk1_tout_hit = 0;
  607. assign xbrk1_goto0_hit = 0;
  608. assign xbrk1_goto1_hit = 0;
  609. assign xbrk2_break_hit = 0;
  610. assign xbrk2_ton_hit = 0;
  611. assign xbrk2_toff_hit = 0;
  612. assign xbrk2_tout_hit = 0;
  613. assign xbrk2_goto0_hit = 0;
  614. assign xbrk2_goto1_hit = 0;
  615. assign xbrk3_break_hit = 0;
  616. assign xbrk3_ton_hit = 0;
  617. assign xbrk3_toff_hit = 0;
  618. assign xbrk3_tout_hit = 0;
  619. assign xbrk3_goto0_hit = 0;
  620. assign xbrk3_goto1_hit = 0;
  621. assign xbrk_break_hit = (xbrk0_break_hit) | (xbrk1_break_hit) | (xbrk2_break_hit) | (xbrk3_break_hit);
  622. assign xbrk_ton_hit = (xbrk0_ton_hit) | (xbrk1_ton_hit) | (xbrk2_ton_hit) | (xbrk3_ton_hit);
  623. assign xbrk_toff_hit = (xbrk0_toff_hit) | (xbrk1_toff_hit) | (xbrk2_toff_hit) | (xbrk3_toff_hit);
  624. assign xbrk_tout_hit = (xbrk0_tout_hit) | (xbrk1_tout_hit) | (xbrk2_tout_hit) | (xbrk3_tout_hit);
  625. assign xbrk_goto0_hit = (xbrk0_goto0_hit) | (xbrk1_goto0_hit) | (xbrk2_goto0_hit) | (xbrk3_goto0_hit);
  626. assign xbrk_goto1_hit = (xbrk0_goto1_hit) | (xbrk1_goto1_hit) | (xbrk2_goto1_hit) | (xbrk3_goto1_hit);
  627. always @(posedge clk or negedge reset_n)
  628. begin
  629. if (reset_n == 0)
  630. xbrk_break <= 0;
  631. else if (E_cpu_addr_en)
  632. xbrk_break <= xbrk_break_hit;
  633. end
  634. always @(posedge clk or negedge reset_n)
  635. begin
  636. if (reset_n == 0)
  637. E_xbrk_traceon <= 0;
  638. else if (E_cpu_addr_en)
  639. E_xbrk_traceon <= xbrk_ton_hit;
  640. end
  641. always @(posedge clk or negedge reset_n)
  642. begin
  643. if (reset_n == 0)
  644. E_xbrk_traceoff <= 0;
  645. else if (E_cpu_addr_en)
  646. E_xbrk_traceoff <= xbrk_toff_hit;
  647. end
  648. always @(posedge clk or negedge reset_n)
  649. begin
  650. if (reset_n == 0)
  651. E_xbrk_trigout <= 0;
  652. else if (E_cpu_addr_en)
  653. E_xbrk_trigout <= xbrk_tout_hit;
  654. end
  655. always @(posedge clk or negedge reset_n)
  656. begin
  657. if (reset_n == 0)
  658. E_xbrk_goto0 <= 0;
  659. else if (E_cpu_addr_en)
  660. E_xbrk_goto0 <= xbrk_goto0_hit;
  661. end
  662. always @(posedge clk or negedge reset_n)
  663. begin
  664. if (reset_n == 0)
  665. E_xbrk_goto1 <= 0;
  666. else if (E_cpu_addr_en)
  667. E_xbrk_goto1 <= xbrk_goto1_hit;
  668. end
  669. assign xbrk_traceon = 1'b0;
  670. assign xbrk_traceoff = 1'b0;
  671. assign xbrk_trigout = 1'b0;
  672. assign xbrk_goto0 = 1'b0;
  673. assign xbrk_goto1 = 1'b0;
  674. assign xbrk0_armed = (xbrk_ctrl0[4] & trigger_state_0) ||
  675. (xbrk_ctrl0[5] & trigger_state_1);
  676. assign xbrk1_armed = (xbrk_ctrl1[4] & trigger_state_0) ||
  677. (xbrk_ctrl1[5] & trigger_state_1);
  678. assign xbrk2_armed = (xbrk_ctrl2[4] & trigger_state_0) ||
  679. (xbrk_ctrl2[5] & trigger_state_1);
  680. assign xbrk3_armed = (xbrk_ctrl3[4] & trigger_state_0) ||
  681. (xbrk_ctrl3[5] & trigger_state_1);
  682. endmodule
  683. // synthesis translate_off
  684. `timescale 1ns / 1ps
  685. // synthesis translate_on
  686. // turn off superfluous verilog processor warnings
  687. // altera message_level Level1
  688. // altera message_off 10034 10035 10036 10037 10230 10240 10030
  689. module nios2_uc_nios2_cpu_nios2_oci_dbrk (
  690. // inputs:
  691. E_st_data,
  692. av_ld_data_aligned_filtered,
  693. clk,
  694. d_address,
  695. d_read,
  696. d_waitrequest,
  697. d_write,
  698. debugack,
  699. reset_n,
  700. // outputs:
  701. cpu_d_address,
  702. cpu_d_read,
  703. cpu_d_readdata,
  704. cpu_d_wait,
  705. cpu_d_write,
  706. cpu_d_writedata,
  707. dbrk_break,
  708. dbrk_goto0,
  709. dbrk_goto1,
  710. dbrk_traceme,
  711. dbrk_traceoff,
  712. dbrk_traceon,
  713. dbrk_trigout
  714. )
  715. ;
  716. output [ 19: 0] cpu_d_address;
  717. output cpu_d_read;
  718. output [ 31: 0] cpu_d_readdata;
  719. output cpu_d_wait;
  720. output cpu_d_write;
  721. output [ 31: 0] cpu_d_writedata;
  722. output dbrk_break;
  723. output dbrk_goto0;
  724. output dbrk_goto1;
  725. output dbrk_traceme;
  726. output dbrk_traceoff;
  727. output dbrk_traceon;
  728. output dbrk_trigout;
  729. input [ 31: 0] E_st_data;
  730. input [ 31: 0] av_ld_data_aligned_filtered;
  731. input clk;
  732. input [ 19: 0] d_address;
  733. input d_read;
  734. input d_waitrequest;
  735. input d_write;
  736. input debugack;
  737. input reset_n;
  738. wire [ 19: 0] cpu_d_address;
  739. wire cpu_d_read;
  740. wire [ 31: 0] cpu_d_readdata;
  741. wire cpu_d_wait;
  742. wire cpu_d_write;
  743. wire [ 31: 0] cpu_d_writedata;
  744. wire dbrk0_armed;
  745. wire dbrk0_break_pulse;
  746. wire dbrk0_goto0;
  747. wire dbrk0_goto1;
  748. wire dbrk0_traceme;
  749. wire dbrk0_traceoff;
  750. wire dbrk0_traceon;
  751. wire dbrk0_trigout;
  752. wire dbrk1_armed;
  753. wire dbrk1_break_pulse;
  754. wire dbrk1_goto0;
  755. wire dbrk1_goto1;
  756. wire dbrk1_traceme;
  757. wire dbrk1_traceoff;
  758. wire dbrk1_traceon;
  759. wire dbrk1_trigout;
  760. wire dbrk2_armed;
  761. wire dbrk2_break_pulse;
  762. wire dbrk2_goto0;
  763. wire dbrk2_goto1;
  764. wire dbrk2_traceme;
  765. wire dbrk2_traceoff;
  766. wire dbrk2_traceon;
  767. wire dbrk2_trigout;
  768. wire dbrk3_armed;
  769. wire dbrk3_break_pulse;
  770. wire dbrk3_goto0;
  771. wire dbrk3_goto1;
  772. wire dbrk3_traceme;
  773. wire dbrk3_traceoff;
  774. wire dbrk3_traceon;
  775. wire dbrk3_trigout;
  776. reg dbrk_break;
  777. reg dbrk_break_pulse;
  778. wire [ 31: 0] dbrk_data;
  779. reg dbrk_goto0;
  780. reg dbrk_goto1;
  781. reg dbrk_traceme;
  782. reg dbrk_traceoff;
  783. reg dbrk_traceon;
  784. reg dbrk_trigout;
  785. assign cpu_d_address = d_address;
  786. assign cpu_d_readdata = av_ld_data_aligned_filtered;
  787. assign cpu_d_read = d_read;
  788. assign cpu_d_writedata = E_st_data;
  789. assign cpu_d_write = d_write;
  790. assign cpu_d_wait = d_waitrequest;
  791. assign dbrk_data = cpu_d_write ? cpu_d_writedata : cpu_d_readdata;
  792. always @(posedge clk or negedge reset_n)
  793. begin
  794. if (reset_n == 0)
  795. dbrk_break <= 0;
  796. else
  797. dbrk_break <= dbrk_break ? ~debugack
  798. : dbrk_break_pulse;
  799. end
  800. assign dbrk0_armed = 1'b0;
  801. assign dbrk0_trigout = 1'b0;
  802. assign dbrk0_break_pulse = 1'b0;
  803. assign dbrk0_traceoff = 1'b0;
  804. assign dbrk0_traceon = 1'b0;
  805. assign dbrk0_traceme = 1'b0;
  806. assign dbrk0_goto0 = 1'b0;
  807. assign dbrk0_goto1 = 1'b0;
  808. assign dbrk1_armed = 1'b0;
  809. assign dbrk1_trigout = 1'b0;
  810. assign dbrk1_break_pulse = 1'b0;
  811. assign dbrk1_traceoff = 1'b0;
  812. assign dbrk1_traceon = 1'b0;
  813. assign dbrk1_traceme = 1'b0;
  814. assign dbrk1_goto0 = 1'b0;
  815. assign dbrk1_goto1 = 1'b0;
  816. assign dbrk2_armed = 1'b0;
  817. assign dbrk2_trigout = 1'b0;
  818. assign dbrk2_break_pulse = 1'b0;
  819. assign dbrk2_traceoff = 1'b0;
  820. assign dbrk2_traceon = 1'b0;
  821. assign dbrk2_traceme = 1'b0;
  822. assign dbrk2_goto0 = 1'b0;
  823. assign dbrk2_goto1 = 1'b0;
  824. assign dbrk3_armed = 1'b0;
  825. assign dbrk3_trigout = 1'b0;
  826. assign dbrk3_break_pulse = 1'b0;
  827. assign dbrk3_traceoff = 1'b0;
  828. assign dbrk3_traceon = 1'b0;
  829. assign dbrk3_traceme = 1'b0;
  830. assign dbrk3_goto0 = 1'b0;
  831. assign dbrk3_goto1 = 1'b0;
  832. always @(posedge clk or negedge reset_n)
  833. begin
  834. if (reset_n == 0)
  835. begin
  836. dbrk_trigout <= 0;
  837. dbrk_break_pulse <= 0;
  838. dbrk_traceoff <= 0;
  839. dbrk_traceon <= 0;
  840. dbrk_traceme <= 0;
  841. dbrk_goto0 <= 0;
  842. dbrk_goto1 <= 0;
  843. end
  844. else
  845. begin
  846. dbrk_trigout <= dbrk0_trigout | dbrk1_trigout | dbrk2_trigout | dbrk3_trigout;
  847. dbrk_break_pulse <= dbrk0_break_pulse | dbrk1_break_pulse | dbrk2_break_pulse | dbrk3_break_pulse;
  848. dbrk_traceoff <= dbrk0_traceoff | dbrk1_traceoff | dbrk2_traceoff | dbrk3_traceoff;
  849. dbrk_traceon <= dbrk0_traceon | dbrk1_traceon | dbrk2_traceon | dbrk3_traceon;
  850. dbrk_traceme <= dbrk0_traceme | dbrk1_traceme | dbrk2_traceme | dbrk3_traceme;
  851. dbrk_goto0 <= dbrk0_goto0 | dbrk1_goto0 | dbrk2_goto0 | dbrk3_goto0;
  852. dbrk_goto1 <= dbrk0_goto1 | dbrk1_goto1 | dbrk2_goto1 | dbrk3_goto1;
  853. end
  854. end
  855. endmodule
  856. // synthesis translate_off
  857. `timescale 1ns / 1ps
  858. // synthesis translate_on
  859. // turn off superfluous verilog processor warnings
  860. // altera message_level Level1
  861. // altera message_off 10034 10035 10036 10037 10230 10240 10030
  862. module nios2_uc_nios2_cpu_nios2_oci_itrace (
  863. // inputs:
  864. clk,
  865. dbrk_traceoff,
  866. dbrk_traceon,
  867. jdo,
  868. jrst_n,
  869. take_action_tracectrl,
  870. xbrk_traceoff,
  871. xbrk_traceon,
  872. xbrk_wrap_traceoff,
  873. // outputs:
  874. itm,
  875. trc_ctrl,
  876. trc_on
  877. )
  878. ;
  879. output [ 35: 0] itm;
  880. output [ 15: 0] trc_ctrl;
  881. output trc_on;
  882. input clk;
  883. input dbrk_traceoff;
  884. input dbrk_traceon;
  885. input [ 15: 0] jdo;
  886. input jrst_n;
  887. input take_action_tracectrl;
  888. input xbrk_traceoff;
  889. input xbrk_traceon;
  890. input xbrk_wrap_traceoff;
  891. wire advanced_exc_occured;
  892. wire curr_pid;
  893. wire [ 1: 0] dct_code;
  894. wire dct_is_taken;
  895. wire [ 31: 0] eic_addr;
  896. wire [ 31: 0] exc_addr;
  897. wire instr_retired;
  898. wire is_cond_dct;
  899. wire is_dct;
  900. wire is_exception_no_break;
  901. wire is_external_interrupt;
  902. wire is_fast_tlb_miss_exception;
  903. wire is_idct;
  904. wire [ 35: 0] itm;
  905. wire not_in_debug_mode;
  906. wire record_dct_outcome_in_sync;
  907. wire record_itrace;
  908. wire [ 31: 0] retired_pcb;
  909. wire [ 1: 0] sync_code;
  910. wire [ 6: 0] sync_interval;
  911. wire [ 6: 0] sync_timer;
  912. wire [ 6: 0] sync_timer_next;
  913. wire sync_timer_reached_zero;
  914. wire [ 15: 0] trc_ctrl;
  915. reg [ 10: 0] trc_ctrl_reg /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,D103,R101\"" */;
  916. wire trc_on;
  917. assign is_cond_dct = 1'b0;
  918. assign is_dct = 1'b0;
  919. assign dct_is_taken = 1'b0;
  920. assign is_idct = 1'b0;
  921. assign retired_pcb = 32'b0;
  922. assign not_in_debug_mode = 1'b0;
  923. assign instr_retired = 1'b0;
  924. assign advanced_exc_occured = 1'b0;
  925. assign is_exception_no_break = 1'b0;
  926. assign is_external_interrupt = 1'b0;
  927. assign is_fast_tlb_miss_exception = 1'b0;
  928. assign curr_pid = 1'b0;
  929. assign exc_addr = 32'b0;
  930. assign eic_addr = 32'b0;
  931. assign sync_code = trc_ctrl[3 : 2];
  932. assign sync_interval = { sync_code[1] & sync_code[0], 1'b0, sync_code[1] & ~sync_code[0], 1'b0, ~sync_code[1] & sync_code[0], 2'b00 };
  933. assign sync_timer_reached_zero = sync_timer == 0;
  934. assign record_dct_outcome_in_sync = dct_is_taken & sync_timer_reached_zero;
  935. assign sync_timer_next = sync_timer_reached_zero ? sync_timer : (sync_timer - 1);
  936. assign record_itrace = trc_on & trc_ctrl[4];
  937. assign dct_code = {is_cond_dct, dct_is_taken};
  938. assign itm = 36'd0;
  939. assign sync_timer = 7'd1;
  940. always @(posedge clk or negedge jrst_n)
  941. begin
  942. if (jrst_n == 0)
  943. begin
  944. trc_ctrl_reg[0] <= 1'b0;
  945. trc_ctrl_reg[1] <= 1'b0;
  946. trc_ctrl_reg[3 : 2] <= 2'b00;
  947. trc_ctrl_reg[4] <= 1'b0;
  948. trc_ctrl_reg[7 : 5] <= 3'b000;
  949. trc_ctrl_reg[8] <= 0;
  950. trc_ctrl_reg[9] <= 1'b0;
  951. trc_ctrl_reg[10] <= 1'b0;
  952. end
  953. else if (take_action_tracectrl)
  954. begin
  955. trc_ctrl_reg[0] <= jdo[5];
  956. trc_ctrl_reg[1] <= jdo[6];
  957. trc_ctrl_reg[3 : 2] <= jdo[8 : 7];
  958. trc_ctrl_reg[4] <= jdo[9];
  959. trc_ctrl_reg[9] <= jdo[14];
  960. trc_ctrl_reg[10] <= jdo[2];
  961. trc_ctrl_reg[7 : 5] <= 3'b000;
  962. trc_ctrl_reg[8] <= 1'b0;
  963. end
  964. else if (xbrk_wrap_traceoff)
  965. begin
  966. trc_ctrl_reg[1] <= 0;
  967. trc_ctrl_reg[0] <= 0;
  968. end
  969. else if (dbrk_traceoff | xbrk_traceoff)
  970. trc_ctrl_reg[1] <= 0;
  971. else if (trc_ctrl_reg[0] &
  972. (dbrk_traceon | xbrk_traceon))
  973. trc_ctrl_reg[1] <= 1;
  974. end
  975. assign trc_ctrl = 0;
  976. assign trc_on = trc_ctrl[1] & (trc_ctrl[9] | not_in_debug_mode);
  977. endmodule
  978. // synthesis translate_off
  979. `timescale 1ns / 1ps
  980. // synthesis translate_on
  981. // turn off superfluous verilog processor warnings
  982. // altera message_level Level1
  983. // altera message_off 10034 10035 10036 10037 10230 10240 10030
  984. module nios2_uc_nios2_cpu_nios2_oci_td_mode (
  985. // inputs:
  986. ctrl,
  987. // outputs:
  988. td_mode
  989. )
  990. ;
  991. output [ 3: 0] td_mode;
  992. input [ 8: 0] ctrl;
  993. wire [ 2: 0] ctrl_bits_for_mux;
  994. reg [ 3: 0] td_mode;
  995. assign ctrl_bits_for_mux = ctrl[7 : 5];
  996. always @(ctrl_bits_for_mux)
  997. begin
  998. case (ctrl_bits_for_mux)
  999. 3'b000: begin
  1000. td_mode = 4'b0000;
  1001. end // 3'b000
  1002. 3'b001: begin
  1003. td_mode = 4'b1000;
  1004. end // 3'b001
  1005. 3'b010: begin
  1006. td_mode = 4'b0100;
  1007. end // 3'b010
  1008. 3'b011: begin
  1009. td_mode = 4'b1100;
  1010. end // 3'b011
  1011. 3'b100: begin
  1012. td_mode = 4'b0010;
  1013. end // 3'b100
  1014. 3'b101: begin
  1015. td_mode = 4'b1010;
  1016. end // 3'b101
  1017. 3'b110: begin
  1018. td_mode = 4'b0101;
  1019. end // 3'b110
  1020. 3'b111: begin
  1021. td_mode = 4'b1111;
  1022. end // 3'b111
  1023. endcase // ctrl_bits_for_mux
  1024. end
  1025. endmodule
  1026. // synthesis translate_off
  1027. `timescale 1ns / 1ps
  1028. // synthesis translate_on
  1029. // turn off superfluous verilog processor warnings
  1030. // altera message_level Level1
  1031. // altera message_off 10034 10035 10036 10037 10230 10240 10030
  1032. module nios2_uc_nios2_cpu_nios2_oci_dtrace (
  1033. // inputs:
  1034. clk,
  1035. cpu_d_address,
  1036. cpu_d_read,
  1037. cpu_d_readdata,
  1038. cpu_d_wait,
  1039. cpu_d_write,
  1040. cpu_d_writedata,
  1041. jrst_n,
  1042. trc_ctrl,
  1043. // outputs:
  1044. atm,
  1045. dtm
  1046. )
  1047. ;
  1048. output [ 35: 0] atm;
  1049. output [ 35: 0] dtm;
  1050. input clk;
  1051. input [ 19: 0] cpu_d_address;
  1052. input cpu_d_read;
  1053. input [ 31: 0] cpu_d_readdata;
  1054. input cpu_d_wait;
  1055. input cpu_d_write;
  1056. input [ 31: 0] cpu_d_writedata;
  1057. input jrst_n;
  1058. input [ 15: 0] trc_ctrl;
  1059. reg [ 35: 0] atm /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=R101" */;
  1060. wire [ 31: 0] cpu_d_address_0_padded;
  1061. wire [ 31: 0] cpu_d_readdata_0_padded;
  1062. wire [ 31: 0] cpu_d_writedata_0_padded;
  1063. reg [ 35: 0] dtm /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=R101" */;
  1064. wire dummy_tie_off;
  1065. wire record_load_addr;
  1066. wire record_load_data;
  1067. wire record_store_addr;
  1068. wire record_store_data;
  1069. wire [ 3: 0] td_mode_trc_ctrl;
  1070. assign cpu_d_writedata_0_padded = cpu_d_writedata | 32'b0;
  1071. assign cpu_d_readdata_0_padded = cpu_d_readdata | 32'b0;
  1072. assign cpu_d_address_0_padded = cpu_d_address | 32'b0;
  1073. //nios2_uc_nios2_cpu_nios2_oci_trc_ctrl_td_mode, which is an e_instance
  1074. nios2_uc_nios2_cpu_nios2_oci_td_mode nios2_uc_nios2_cpu_nios2_oci_trc_ctrl_td_mode
  1075. (
  1076. .ctrl (trc_ctrl[8 : 0]),
  1077. .td_mode (td_mode_trc_ctrl)
  1078. );
  1079. assign {record_load_addr, record_store_addr,
  1080. record_load_data, record_store_data} = td_mode_trc_ctrl;
  1081. always @(posedge clk or negedge jrst_n)
  1082. begin
  1083. if (jrst_n == 0)
  1084. begin
  1085. atm <= 0;
  1086. dtm <= 0;
  1087. end
  1088. else
  1089. begin
  1090. atm <= 0;
  1091. dtm <= 0;
  1092. end
  1093. end
  1094. assign dummy_tie_off = cpu_d_wait|cpu_d_read|cpu_d_write;
  1095. endmodule
  1096. // synthesis translate_off
  1097. `timescale 1ns / 1ps
  1098. // synthesis translate_on
  1099. // turn off superfluous verilog processor warnings
  1100. // altera message_level Level1
  1101. // altera message_off 10034 10035 10036 10037 10230 10240 10030
  1102. module nios2_uc_nios2_cpu_nios2_oci_compute_input_tm_cnt (
  1103. // inputs:
  1104. atm_valid,
  1105. dtm_valid,
  1106. itm_valid,
  1107. // outputs:
  1108. compute_input_tm_cnt
  1109. )
  1110. ;
  1111. output [ 1: 0] compute_input_tm_cnt;
  1112. input atm_valid;
  1113. input dtm_valid;
  1114. input itm_valid;
  1115. reg [ 1: 0] compute_input_tm_cnt;
  1116. wire [ 2: 0] switch_for_mux;
  1117. assign switch_for_mux = {itm_valid, atm_valid, dtm_valid};
  1118. always @(switch_for_mux)
  1119. begin
  1120. case (switch_for_mux)
  1121. 3'b000: begin
  1122. compute_input_tm_cnt = 0;
  1123. end // 3'b000
  1124. 3'b001: begin
  1125. compute_input_tm_cnt = 1;
  1126. end // 3'b001
  1127. 3'b010: begin
  1128. compute_input_tm_cnt = 1;
  1129. end // 3'b010
  1130. 3'b011: begin
  1131. compute_input_tm_cnt = 2;
  1132. end // 3'b011
  1133. 3'b100: begin
  1134. compute_input_tm_cnt = 1;
  1135. end // 3'b100
  1136. 3'b101: begin
  1137. compute_input_tm_cnt = 2;
  1138. end // 3'b101
  1139. 3'b110: begin
  1140. compute_input_tm_cnt = 2;
  1141. end // 3'b110
  1142. 3'b111: begin
  1143. compute_input_tm_cnt = 3;
  1144. end // 3'b111
  1145. endcase // switch_for_mux
  1146. end
  1147. endmodule
  1148. // synthesis translate_off
  1149. `timescale 1ns / 1ps
  1150. // synthesis translate_on
  1151. // turn off superfluous verilog processor warnings
  1152. // altera message_level Level1
  1153. // altera message_off 10034 10035 10036 10037 10230 10240 10030
  1154. module nios2_uc_nios2_cpu_nios2_oci_fifo_wrptr_inc (
  1155. // inputs:
  1156. ge2_free,
  1157. ge3_free,
  1158. input_tm_cnt,
  1159. // outputs:
  1160. fifo_wrptr_inc
  1161. )
  1162. ;
  1163. output [ 3: 0] fifo_wrptr_inc;
  1164. input ge2_free;
  1165. input ge3_free;
  1166. input [ 1: 0] input_tm_cnt;
  1167. reg [ 3: 0] fifo_wrptr_inc;
  1168. always @(ge2_free or ge3_free or input_tm_cnt)
  1169. begin
  1170. if (ge3_free & (input_tm_cnt == 3))
  1171. fifo_wrptr_inc = 3;
  1172. else if (ge2_free & (input_tm_cnt >= 2))
  1173. fifo_wrptr_inc = 2;
  1174. else if (input_tm_cnt >= 1)
  1175. fifo_wrptr_inc = 1;
  1176. else
  1177. fifo_wrptr_inc = 0;
  1178. end
  1179. endmodule
  1180. // synthesis translate_off
  1181. `timescale 1ns / 1ps
  1182. // synthesis translate_on
  1183. // turn off superfluous verilog processor warnings
  1184. // altera message_level Level1
  1185. // altera message_off 10034 10035 10036 10037 10230 10240 10030
  1186. module nios2_uc_nios2_cpu_nios2_oci_fifo_cnt_inc (
  1187. // inputs:
  1188. empty,
  1189. ge2_free,
  1190. ge3_free,
  1191. input_tm_cnt,
  1192. // outputs:
  1193. fifo_cnt_inc
  1194. )
  1195. ;
  1196. output [ 4: 0] fifo_cnt_inc;
  1197. input empty;
  1198. input ge2_free;
  1199. input ge3_free;
  1200. input [ 1: 0] input_tm_cnt;
  1201. reg [ 4: 0] fifo_cnt_inc;
  1202. always @(empty or ge2_free or ge3_free or input_tm_cnt)
  1203. begin
  1204. if (empty)
  1205. fifo_cnt_inc = input_tm_cnt[1 : 0];
  1206. else if (ge3_free & (input_tm_cnt == 3))
  1207. fifo_cnt_inc = 2;
  1208. else if (ge2_free & (input_tm_cnt >= 2))
  1209. fifo_cnt_inc = 1;
  1210. else if (input_tm_cnt >= 1)
  1211. fifo_cnt_inc = 0;
  1212. else
  1213. fifo_cnt_inc = {5{1'b1}};
  1214. end
  1215. endmodule
  1216. // synthesis translate_off
  1217. `timescale 1ns / 1ps
  1218. // synthesis translate_on
  1219. // turn off superfluous verilog processor warnings
  1220. // altera message_level Level1
  1221. // altera message_off 10034 10035 10036 10037 10230 10240 10030
  1222. module nios2_uc_nios2_cpu_nios2_oci_fifo (
  1223. // inputs:
  1224. atm,
  1225. clk,
  1226. dbrk_traceme,
  1227. dbrk_traceoff,
  1228. dbrk_traceon,
  1229. dtm,
  1230. itm,
  1231. jrst_n,
  1232. reset_n,
  1233. trc_on,
  1234. // outputs:
  1235. tw
  1236. )
  1237. ;
  1238. output [ 35: 0] tw;
  1239. input [ 35: 0] atm;
  1240. input clk;
  1241. input dbrk_traceme;
  1242. input dbrk_traceoff;
  1243. input dbrk_traceon;
  1244. input [ 35: 0] dtm;
  1245. input [ 35: 0] itm;
  1246. input jrst_n;
  1247. input reset_n;
  1248. input trc_on;
  1249. wire atm_valid;
  1250. wire [ 1: 0] compute_input_tm_cnt;
  1251. wire dtm_valid;
  1252. wire empty;
  1253. reg [ 35: 0] fifo_0;
  1254. wire fifo_0_enable;
  1255. wire [ 35: 0] fifo_0_mux;
  1256. reg [ 35: 0] fifo_1;
  1257. reg [ 35: 0] fifo_10;
  1258. wire fifo_10_enable;
  1259. wire [ 35: 0] fifo_10_mux;
  1260. reg [ 35: 0] fifo_11;
  1261. wire fifo_11_enable;
  1262. wire [ 35: 0] fifo_11_mux;
  1263. reg [ 35: 0] fifo_12;
  1264. wire fifo_12_enable;
  1265. wire [ 35: 0] fifo_12_mux;
  1266. reg [ 35: 0] fifo_13;
  1267. wire fifo_13_enable;
  1268. wire [ 35: 0] fifo_13_mux;
  1269. reg [ 35: 0] fifo_14;
  1270. wire fifo_14_enable;
  1271. wire [ 35: 0] fifo_14_mux;
  1272. reg [ 35: 0] fifo_15;
  1273. wire fifo_15_enable;
  1274. wire [ 35: 0] fifo_15_mux;
  1275. wire fifo_1_enable;
  1276. wire [ 35: 0] fifo_1_mux;
  1277. reg [ 35: 0] fifo_2;
  1278. wire fifo_2_enable;
  1279. wire [ 35: 0] fifo_2_mux;
  1280. reg [ 35: 0] fifo_3;
  1281. wire fifo_3_enable;
  1282. wire [ 35: 0] fifo_3_mux;
  1283. reg [ 35: 0] fifo_4;
  1284. wire fifo_4_enable;
  1285. wire [ 35: 0] fifo_4_mux;
  1286. reg [ 35: 0] fifo_5;
  1287. wire fifo_5_enable;
  1288. wire [ 35: 0] fifo_5_mux;
  1289. reg [ 35: 0] fifo_6;
  1290. wire fifo_6_enable;
  1291. wire [ 35: 0] fifo_6_mux;
  1292. reg [ 35: 0] fifo_7;
  1293. wire fifo_7_enable;
  1294. wire [ 35: 0] fifo_7_mux;
  1295. reg [ 35: 0] fifo_8;
  1296. wire fifo_8_enable;
  1297. wire [ 35: 0] fifo_8_mux;
  1298. reg [ 35: 0] fifo_9;
  1299. wire fifo_9_enable;
  1300. wire [ 35: 0] fifo_9_mux;
  1301. reg [ 4: 0] fifo_cnt /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=R101" */;
  1302. wire [ 4: 0] fifo_cnt_inc;
  1303. wire [ 35: 0] fifo_head;
  1304. reg [ 3: 0] fifo_rdptr /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=R101" */;
  1305. wire [ 35: 0] fifo_read_mux;
  1306. reg [ 3: 0] fifo_wrptr /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=R101" */;
  1307. wire [ 3: 0] fifo_wrptr_inc;
  1308. wire [ 3: 0] fifo_wrptr_plus1;
  1309. wire [ 3: 0] fifo_wrptr_plus2;
  1310. wire ge2_free;
  1311. wire ge3_free;
  1312. wire input_ge1;
  1313. wire input_ge2;
  1314. wire input_ge3;
  1315. wire [ 1: 0] input_tm_cnt;
  1316. wire itm_valid;
  1317. reg overflow_pending /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=R101" */;
  1318. wire [ 35: 0] overflow_pending_atm;
  1319. wire [ 35: 0] overflow_pending_dtm;
  1320. wire trc_this;
  1321. wire [ 35: 0] tw;
  1322. assign trc_this = trc_on | (dbrk_traceon & ~dbrk_traceoff) | dbrk_traceme;
  1323. assign itm_valid = |itm[35 : 32];
  1324. assign atm_valid = |atm[35 : 32] & trc_this;
  1325. assign dtm_valid = |dtm[35 : 32] & trc_this;
  1326. assign ge2_free = ~fifo_cnt[4];
  1327. assign ge3_free = ge2_free & ~&fifo_cnt[3 : 0];
  1328. assign empty = ~|fifo_cnt;
  1329. assign fifo_wrptr_plus1 = fifo_wrptr + 1;
  1330. assign fifo_wrptr_plus2 = fifo_wrptr + 2;
  1331. nios2_uc_nios2_cpu_nios2_oci_compute_input_tm_cnt the_nios2_uc_nios2_cpu_nios2_oci_compute_input_tm_cnt
  1332. (
  1333. .atm_valid (atm_valid),
  1334. .compute_input_tm_cnt (compute_input_tm_cnt),
  1335. .dtm_valid (dtm_valid),
  1336. .itm_valid (itm_valid)
  1337. );
  1338. assign input_tm_cnt = compute_input_tm_cnt;
  1339. nios2_uc_nios2_cpu_nios2_oci_fifo_wrptr_inc the_nios2_uc_nios2_cpu_nios2_oci_fifo_wrptr_inc
  1340. (
  1341. .fifo_wrptr_inc (fifo_wrptr_inc),
  1342. .ge2_free (ge2_free),
  1343. .ge3_free (ge3_free),
  1344. .input_tm_cnt (input_tm_cnt)
  1345. );
  1346. nios2_uc_nios2_cpu_nios2_oci_fifo_cnt_inc the_nios2_uc_nios2_cpu_nios2_oci_fifo_cnt_inc
  1347. (
  1348. .empty (empty),
  1349. .fifo_cnt_inc (fifo_cnt_inc),
  1350. .ge2_free (ge2_free),
  1351. .ge3_free (ge3_free),
  1352. .input_tm_cnt (input_tm_cnt)
  1353. );
  1354. always @(posedge clk or negedge jrst_n)
  1355. begin
  1356. if (jrst_n == 0)
  1357. begin
  1358. fifo_rdptr <= 0;
  1359. fifo_wrptr <= 0;
  1360. fifo_cnt <= 0;
  1361. overflow_pending <= 1;
  1362. end
  1363. else
  1364. begin
  1365. fifo_wrptr <= fifo_wrptr + fifo_wrptr_inc;
  1366. fifo_cnt <= fifo_cnt + fifo_cnt_inc;
  1367. if (~empty)
  1368. fifo_rdptr <= fifo_rdptr + 1;
  1369. if (~trc_this || (~ge2_free & input_ge2) || (~ge3_free & input_ge3))
  1370. overflow_pending <= 1;
  1371. else if (atm_valid | dtm_valid)
  1372. overflow_pending <= 0;
  1373. end
  1374. end
  1375. assign fifo_head = fifo_read_mux;
  1376. assign tw = itm;
  1377. assign fifo_0_enable = ((fifo_wrptr == 4'd0) && input_ge1) || (ge2_free && (fifo_wrptr_plus1== 4'd0) && input_ge2) ||(ge3_free && (fifo_wrptr_plus2== 4'd0) && input_ge3);
  1378. always @(posedge clk or negedge reset_n)
  1379. begin
  1380. if (reset_n == 0)
  1381. fifo_0 <= 0;
  1382. else if (fifo_0_enable)
  1383. fifo_0 <= fifo_0_mux;
  1384. end
  1385. assign fifo_0_mux = (((fifo_wrptr == 4'd0) && itm_valid))? itm :
  1386. (((fifo_wrptr == 4'd0) && atm_valid))? overflow_pending_atm :
  1387. (((fifo_wrptr == 4'd0) && dtm_valid))? overflow_pending_dtm :
  1388. (((fifo_wrptr_plus1 == 4'd0) && (ge2_free & itm_valid & atm_valid)))? overflow_pending_atm :
  1389. (((fifo_wrptr_plus1 == 4'd0) && (ge2_free & itm_valid & dtm_valid)))? overflow_pending_dtm :
  1390. (((fifo_wrptr_plus1 == 4'd0) && (ge2_free & atm_valid & dtm_valid)))? overflow_pending_dtm :
  1391. overflow_pending_dtm;
  1392. assign fifo_1_enable = ((fifo_wrptr == 4'd1) && input_ge1) || (ge2_free && (fifo_wrptr_plus1== 4'd1) && input_ge2) ||(ge3_free && (fifo_wrptr_plus2== 4'd1) && input_ge3);
  1393. always @(posedge clk or negedge reset_n)
  1394. begin
  1395. if (reset_n == 0)
  1396. fifo_1 <= 0;
  1397. else if (fifo_1_enable)
  1398. fifo_1 <= fifo_1_mux;
  1399. end
  1400. assign fifo_1_mux = (((fifo_wrptr == 4'd1) && itm_valid))? itm :
  1401. (((fifo_wrptr == 4'd1) && atm_valid))? overflow_pending_atm :
  1402. (((fifo_wrptr == 4'd1) && dtm_valid))? overflow_pending_dtm :
  1403. (((fifo_wrptr_plus1 == 4'd1) && (ge2_free & itm_valid & atm_valid)))? overflow_pending_atm :
  1404. (((fifo_wrptr_plus1 == 4'd1) && (ge2_free & itm_valid & dtm_valid)))? overflow_pending_dtm :
  1405. (((fifo_wrptr_plus1 == 4'd1) && (ge2_free & atm_valid & dtm_valid)))? overflow_pending_dtm :
  1406. overflow_pending_dtm;
  1407. assign fifo_2_enable = ((fifo_wrptr == 4'd2) && input_ge1) || (ge2_free && (fifo_wrptr_plus1== 4'd2) && input_ge2) ||(ge3_free && (fifo_wrptr_plus2== 4'd2) && input_ge3);
  1408. always @(posedge clk or negedge reset_n)
  1409. begin
  1410. if (reset_n == 0)
  1411. fifo_2 <= 0;
  1412. else if (fifo_2_enable)
  1413. fifo_2 <= fifo_2_mux;
  1414. end
  1415. assign fifo_2_mux = (((fifo_wrptr == 4'd2) && itm_valid))? itm :
  1416. (((fifo_wrptr == 4'd2) && atm_valid))? overflow_pending_atm :
  1417. (((fifo_wrptr == 4'd2) && dtm_valid))? overflow_pending_dtm :
  1418. (((fifo_wrptr_plus1 == 4'd2) && (ge2_free & itm_valid & atm_valid)))? overflow_pending_atm :
  1419. (((fifo_wrptr_plus1 == 4'd2) && (ge2_free & itm_valid & dtm_valid)))? overflow_pending_dtm :
  1420. (((fifo_wrptr_plus1 == 4'd2) && (ge2_free & atm_valid & dtm_valid)))? overflow_pending_dtm :
  1421. overflow_pending_dtm;
  1422. assign fifo_3_enable = ((fifo_wrptr == 4'd3) && input_ge1) || (ge2_free && (fifo_wrptr_plus1== 4'd3) && input_ge2) ||(ge3_free && (fifo_wrptr_plus2== 4'd3) && input_ge3);
  1423. always @(posedge clk or negedge reset_n)
  1424. begin
  1425. if (reset_n == 0)
  1426. fifo_3 <= 0;
  1427. else if (fifo_3_enable)
  1428. fifo_3 <= fifo_3_mux;
  1429. end
  1430. assign fifo_3_mux = (((fifo_wrptr == 4'd3) && itm_valid))? itm :
  1431. (((fifo_wrptr == 4'd3) && atm_valid))? overflow_pending_atm :
  1432. (((fifo_wrptr == 4'd3) && dtm_valid))? overflow_pending_dtm :
  1433. (((fifo_wrptr_plus1 == 4'd3) && (ge2_free & itm_valid & atm_valid)))? overflow_pending_atm :
  1434. (((fifo_wrptr_plus1 == 4'd3) && (ge2_free & itm_valid & dtm_valid)))? overflow_pending_dtm :
  1435. (((fifo_wrptr_plus1 == 4'd3) && (ge2_free & atm_valid & dtm_valid)))? overflow_pending_dtm :
  1436. overflow_pending_dtm;
  1437. assign fifo_4_enable = ((fifo_wrptr == 4'd4) && input_ge1) || (ge2_free && (fifo_wrptr_plus1== 4'd4) && input_ge2) ||(ge3_free && (fifo_wrptr_plus2== 4'd4) && input_ge3);
  1438. always @(posedge clk or negedge reset_n)
  1439. begin
  1440. if (reset_n == 0)
  1441. fifo_4 <= 0;
  1442. else if (fifo_4_enable)
  1443. fifo_4 <= fifo_4_mux;
  1444. end
  1445. assign fifo_4_mux = (((fifo_wrptr == 4'd4) && itm_valid))? itm :
  1446. (((fifo_wrptr == 4'd4) && atm_valid))? overflow_pending_atm :
  1447. (((fifo_wrptr == 4'd4) && dtm_valid))? overflow_pending_dtm :
  1448. (((fifo_wrptr_plus1 == 4'd4) && (ge2_free & itm_valid & atm_valid)))? overflow_pending_atm :
  1449. (((fifo_wrptr_plus1 == 4'd4) && (ge2_free & itm_valid & dtm_valid)))? overflow_pending_dtm :
  1450. (((fifo_wrptr_plus1 == 4'd4) && (ge2_free & atm_valid & dtm_valid)))? overflow_pending_dtm :
  1451. overflow_pending_dtm;
  1452. assign fifo_5_enable = ((fifo_wrptr == 4'd5) && input_ge1) || (ge2_free && (fifo_wrptr_plus1== 4'd5) && input_ge2) ||(ge3_free && (fifo_wrptr_plus2== 4'd5) && input_ge3);
  1453. always @(posedge clk or negedge reset_n)
  1454. begin
  1455. if (reset_n == 0)
  1456. fifo_5 <= 0;
  1457. else if (fifo_5_enable)
  1458. fifo_5 <= fifo_5_mux;
  1459. end
  1460. assign fifo_5_mux = (((fifo_wrptr == 4'd5) && itm_valid))? itm :
  1461. (((fifo_wrptr == 4'd5) && atm_valid))? overflow_pending_atm :
  1462. (((fifo_wrptr == 4'd5) && dtm_valid))? overflow_pending_dtm :
  1463. (((fifo_wrptr_plus1 == 4'd5) && (ge2_free & itm_valid & atm_valid)))? overflow_pending_atm :
  1464. (((fifo_wrptr_plus1 == 4'd5) && (ge2_free & itm_valid & dtm_valid)))? overflow_pending_dtm :
  1465. (((fifo_wrptr_plus1 == 4'd5) && (ge2_free & atm_valid & dtm_valid)))? overflow_pending_dtm :
  1466. overflow_pending_dtm;
  1467. assign fifo_6_enable = ((fifo_wrptr == 4'd6) && input_ge1) || (ge2_free && (fifo_wrptr_plus1== 4'd6) && input_ge2) ||(ge3_free && (fifo_wrptr_plus2== 4'd6) && input_ge3);
  1468. always @(posedge clk or negedge reset_n)
  1469. begin
  1470. if (reset_n == 0)
  1471. fifo_6 <= 0;
  1472. else if (fifo_6_enable)
  1473. fifo_6 <= fifo_6_mux;
  1474. end
  1475. assign fifo_6_mux = (((fifo_wrptr == 4'd6) && itm_valid))? itm :
  1476. (((fifo_wrptr == 4'd6) && atm_valid))? overflow_pending_atm :
  1477. (((fifo_wrptr == 4'd6) && dtm_valid))? overflow_pending_dtm :
  1478. (((fifo_wrptr_plus1 == 4'd6) && (ge2_free & itm_valid & atm_valid)))? overflow_pending_atm :
  1479. (((fifo_wrptr_plus1 == 4'd6) && (ge2_free & itm_valid & dtm_valid)))? overflow_pending_dtm :
  1480. (((fifo_wrptr_plus1 == 4'd6) && (ge2_free & atm_valid & dtm_valid)))? overflow_pending_dtm :
  1481. overflow_pending_dtm;
  1482. assign fifo_7_enable = ((fifo_wrptr == 4'd7) && input_ge1) || (ge2_free && (fifo_wrptr_plus1== 4'd7) && input_ge2) ||(ge3_free && (fifo_wrptr_plus2== 4'd7) && input_ge3);
  1483. always @(posedge clk or negedge reset_n)
  1484. begin
  1485. if (reset_n == 0)
  1486. fifo_7 <= 0;
  1487. else if (fifo_7_enable)
  1488. fifo_7 <= fifo_7_mux;
  1489. end
  1490. assign fifo_7_mux = (((fifo_wrptr == 4'd7) && itm_valid))? itm :
  1491. (((fifo_wrptr == 4'd7) && atm_valid))? overflow_pending_atm :
  1492. (((fifo_wrptr == 4'd7) && dtm_valid))? overflow_pending_dtm :
  1493. (((fifo_wrptr_plus1 == 4'd7) && (ge2_free & itm_valid & atm_valid)))? overflow_pending_atm :
  1494. (((fifo_wrptr_plus1 == 4'd7) && (ge2_free & itm_valid & dtm_valid)))? overflow_pending_dtm :
  1495. (((fifo_wrptr_plus1 == 4'd7) && (ge2_free & atm_valid & dtm_valid)))? overflow_pending_dtm :
  1496. overflow_pending_dtm;
  1497. assign fifo_8_enable = ((fifo_wrptr == 4'd8) && input_ge1) || (ge2_free && (fifo_wrptr_plus1== 4'd8) && input_ge2) ||(ge3_free && (fifo_wrptr_plus2== 4'd8) && input_ge3);
  1498. always @(posedge clk or negedge reset_n)
  1499. begin
  1500. if (reset_n == 0)
  1501. fifo_8 <= 0;
  1502. else if (fifo_8_enable)
  1503. fifo_8 <= fifo_8_mux;
  1504. end
  1505. assign fifo_8_mux = (((fifo_wrptr == 4'd8) && itm_valid))? itm :
  1506. (((fifo_wrptr == 4'd8) && atm_valid))? overflow_pending_atm :
  1507. (((fifo_wrptr == 4'd8) && dtm_valid))? overflow_pending_dtm :
  1508. (((fifo_wrptr_plus1 == 4'd8) && (ge2_free & itm_valid & atm_valid)))? overflow_pending_atm :
  1509. (((fifo_wrptr_plus1 == 4'd8) && (ge2_free & itm_valid & dtm_valid)))? overflow_pending_dtm :
  1510. (((fifo_wrptr_plus1 == 4'd8) && (ge2_free & atm_valid & dtm_valid)))? overflow_pending_dtm :
  1511. overflow_pending_dtm;
  1512. assign fifo_9_enable = ((fifo_wrptr == 4'd9) && input_ge1) || (ge2_free && (fifo_wrptr_plus1== 4'd9) && input_ge2) ||(ge3_free && (fifo_wrptr_plus2== 4'd9) && input_ge3);
  1513. always @(posedge clk or negedge reset_n)
  1514. begin
  1515. if (reset_n == 0)
  1516. fifo_9 <= 0;
  1517. else if (fifo_9_enable)
  1518. fifo_9 <= fifo_9_mux;
  1519. end
  1520. assign fifo_9_mux = (((fifo_wrptr == 4'd9) && itm_valid))? itm :
  1521. (((fifo_wrptr == 4'd9) && atm_valid))? overflow_pending_atm :
  1522. (((fifo_wrptr == 4'd9) && dtm_valid))? overflow_pending_dtm :
  1523. (((fifo_wrptr_plus1 == 4'd9) && (ge2_free & itm_valid & atm_valid)))? overflow_pending_atm :
  1524. (((fifo_wrptr_plus1 == 4'd9) && (ge2_free & itm_valid & dtm_valid)))? overflow_pending_dtm :
  1525. (((fifo_wrptr_plus1 == 4'd9) && (ge2_free & atm_valid & dtm_valid)))? overflow_pending_dtm :
  1526. overflow_pending_dtm;
  1527. assign fifo_10_enable = ((fifo_wrptr == 4'd10) && input_ge1) || (ge2_free && (fifo_wrptr_plus1== 4'd10) && input_ge2) ||(ge3_free && (fifo_wrptr_plus2== 4'd10) && input_ge3);
  1528. always @(posedge clk or negedge reset_n)
  1529. begin
  1530. if (reset_n == 0)
  1531. fifo_10 <= 0;
  1532. else if (fifo_10_enable)
  1533. fifo_10 <= fifo_10_mux;
  1534. end
  1535. assign fifo_10_mux = (((fifo_wrptr == 4'd10) && itm_valid))? itm :
  1536. (((fifo_wrptr == 4'd10) && atm_valid))? overflow_pending_atm :
  1537. (((fifo_wrptr == 4'd10) && dtm_valid))? overflow_pending_dtm :
  1538. (((fifo_wrptr_plus1 == 4'd10) && (ge2_free & itm_valid & atm_valid)))? overflow_pending_atm :
  1539. (((fifo_wrptr_plus1 == 4'd10) && (ge2_free & itm_valid & dtm_valid)))? overflow_pending_dtm :
  1540. (((fifo_wrptr_plus1 == 4'd10) && (ge2_free & atm_valid & dtm_valid)))? overflow_pending_dtm :
  1541. overflow_pending_dtm;
  1542. assign fifo_11_enable = ((fifo_wrptr == 4'd11) && input_ge1) || (ge2_free && (fifo_wrptr_plus1== 4'd11) && input_ge2) ||(ge3_free && (fifo_wrptr_plus2== 4'd11) && input_ge3);
  1543. always @(posedge clk or negedge reset_n)
  1544. begin
  1545. if (reset_n == 0)
  1546. fifo_11 <= 0;
  1547. else if (fifo_11_enable)
  1548. fifo_11 <= fifo_11_mux;
  1549. end
  1550. assign fifo_11_mux = (((fifo_wrptr == 4'd11) && itm_valid))? itm :
  1551. (((fifo_wrptr == 4'd11) && atm_valid))? overflow_pending_atm :
  1552. (((fifo_wrptr == 4'd11) && dtm_valid))? overflow_pending_dtm :
  1553. (((fifo_wrptr_plus1 == 4'd11) && (ge2_free & itm_valid & atm_valid)))? overflow_pending_atm :
  1554. (((fifo_wrptr_plus1 == 4'd11) && (ge2_free & itm_valid & dtm_valid)))? overflow_pending_dtm :
  1555. (((fifo_wrptr_plus1 == 4'd11) && (ge2_free & atm_valid & dtm_valid)))? overflow_pending_dtm :
  1556. overflow_pending_dtm;
  1557. assign fifo_12_enable = ((fifo_wrptr == 4'd12) && input_ge1) || (ge2_free && (fifo_wrptr_plus1== 4'd12) && input_ge2) ||(ge3_free && (fifo_wrptr_plus2== 4'd12) && input_ge3);
  1558. always @(posedge clk or negedge reset_n)
  1559. begin
  1560. if (reset_n == 0)
  1561. fifo_12 <= 0;
  1562. else if (fifo_12_enable)
  1563. fifo_12 <= fifo_12_mux;
  1564. end
  1565. assign fifo_12_mux = (((fifo_wrptr == 4'd12) && itm_valid))? itm :
  1566. (((fifo_wrptr == 4'd12) && atm_valid))? overflow_pending_atm :
  1567. (((fifo_wrptr == 4'd12) && dtm_valid))? overflow_pending_dtm :
  1568. (((fifo_wrptr_plus1 == 4'd12) && (ge2_free & itm_valid & atm_valid)))? overflow_pending_atm :
  1569. (((fifo_wrptr_plus1 == 4'd12) && (ge2_free & itm_valid & dtm_valid)))? overflow_pending_dtm :
  1570. (((fifo_wrptr_plus1 == 4'd12) && (ge2_free & atm_valid & dtm_valid)))? overflow_pending_dtm :
  1571. overflow_pending_dtm;
  1572. assign fifo_13_enable = ((fifo_wrptr == 4'd13) && input_ge1) || (ge2_free && (fifo_wrptr_plus1== 4'd13) && input_ge2) ||(ge3_free && (fifo_wrptr_plus2== 4'd13) && input_ge3);
  1573. always @(posedge clk or negedge reset_n)
  1574. begin
  1575. if (reset_n == 0)
  1576. fifo_13 <= 0;
  1577. else if (fifo_13_enable)
  1578. fifo_13 <= fifo_13_mux;
  1579. end
  1580. assign fifo_13_mux = (((fifo_wrptr == 4'd13) && itm_valid))? itm :
  1581. (((fifo_wrptr == 4'd13) && atm_valid))? overflow_pending_atm :
  1582. (((fifo_wrptr == 4'd13) && dtm_valid))? overflow_pending_dtm :
  1583. (((fifo_wrptr_plus1 == 4'd13) && (ge2_free & itm_valid & atm_valid)))? overflow_pending_atm :
  1584. (((fifo_wrptr_plus1 == 4'd13) && (ge2_free & itm_valid & dtm_valid)))? overflow_pending_dtm :
  1585. (((fifo_wrptr_plus1 == 4'd13) && (ge2_free & atm_valid & dtm_valid)))? overflow_pending_dtm :
  1586. overflow_pending_dtm;
  1587. assign fifo_14_enable = ((fifo_wrptr == 4'd14) && input_ge1) || (ge2_free && (fifo_wrptr_plus1== 4'd14) && input_ge2) ||(ge3_free && (fifo_wrptr_plus2== 4'd14) && input_ge3);
  1588. always @(posedge clk or negedge reset_n)
  1589. begin
  1590. if (reset_n == 0)
  1591. fifo_14 <= 0;
  1592. else if (fifo_14_enable)
  1593. fifo_14 <= fifo_14_mux;
  1594. end
  1595. assign fifo_14_mux = (((fifo_wrptr == 4'd14) && itm_valid))? itm :
  1596. (((fifo_wrptr == 4'd14) && atm_valid))? overflow_pending_atm :
  1597. (((fifo_wrptr == 4'd14) && dtm_valid))? overflow_pending_dtm :
  1598. (((fifo_wrptr_plus1 == 4'd14) && (ge2_free & itm_valid & atm_valid)))? overflow_pending_atm :
  1599. (((fifo_wrptr_plus1 == 4'd14) && (ge2_free & itm_valid & dtm_valid)))? overflow_pending_dtm :
  1600. (((fifo_wrptr_plus1 == 4'd14) && (ge2_free & atm_valid & dtm_valid)))? overflow_pending_dtm :
  1601. overflow_pending_dtm;
  1602. assign fifo_15_enable = ((fifo_wrptr == 4'd15) && input_ge1) || (ge2_free && (fifo_wrptr_plus1== 4'd15) && input_ge2) ||(ge3_free && (fifo_wrptr_plus2== 4'd15) && input_ge3);
  1603. always @(posedge clk or negedge reset_n)
  1604. begin
  1605. if (reset_n == 0)
  1606. fifo_15 <= 0;
  1607. else if (fifo_15_enable)
  1608. fifo_15 <= fifo_15_mux;
  1609. end
  1610. assign fifo_15_mux = (((fifo_wrptr == 4'd15) && itm_valid))? itm :
  1611. (((fifo_wrptr == 4'd15) && atm_valid))? overflow_pending_atm :
  1612. (((fifo_wrptr == 4'd15) && dtm_valid))? overflow_pending_dtm :
  1613. (((fifo_wrptr_plus1 == 4'd15) && (ge2_free & itm_valid & atm_valid)))? overflow_pending_atm :
  1614. (((fifo_wrptr_plus1 == 4'd15) && (ge2_free & itm_valid & dtm_valid)))? overflow_pending_dtm :
  1615. (((fifo_wrptr_plus1 == 4'd15) && (ge2_free & atm_valid & dtm_valid)))? overflow_pending_dtm :
  1616. overflow_pending_dtm;
  1617. assign input_ge1 = |input_tm_cnt;
  1618. assign input_ge2 = input_tm_cnt[1];
  1619. assign input_ge3 = &input_tm_cnt;
  1620. assign overflow_pending_atm = {overflow_pending, atm[34 : 0]};
  1621. assign overflow_pending_dtm = {overflow_pending, dtm[34 : 0]};
  1622. assign fifo_read_mux = (fifo_rdptr == 4'd0)? fifo_0 :
  1623. (fifo_rdptr == 4'd1)? fifo_1 :
  1624. (fifo_rdptr == 4'd2)? fifo_2 :
  1625. (fifo_rdptr == 4'd3)? fifo_3 :
  1626. (fifo_rdptr == 4'd4)? fifo_4 :
  1627. (fifo_rdptr == 4'd5)? fifo_5 :
  1628. (fifo_rdptr == 4'd6)? fifo_6 :
  1629. (fifo_rdptr == 4'd7)? fifo_7 :
  1630. (fifo_rdptr == 4'd8)? fifo_8 :
  1631. (fifo_rdptr == 4'd9)? fifo_9 :
  1632. (fifo_rdptr == 4'd10)? fifo_10 :
  1633. (fifo_rdptr == 4'd11)? fifo_11 :
  1634. (fifo_rdptr == 4'd12)? fifo_12 :
  1635. (fifo_rdptr == 4'd13)? fifo_13 :
  1636. (fifo_rdptr == 4'd14)? fifo_14 :
  1637. fifo_15;
  1638. endmodule
  1639. // synthesis translate_off
  1640. `timescale 1ns / 1ps
  1641. // synthesis translate_on
  1642. // turn off superfluous verilog processor warnings
  1643. // altera message_level Level1
  1644. // altera message_off 10034 10035 10036 10037 10230 10240 10030
  1645. module nios2_uc_nios2_cpu_nios2_oci_pib (
  1646. // outputs:
  1647. tr_data
  1648. )
  1649. ;
  1650. output [ 35: 0] tr_data;
  1651. wire [ 35: 0] tr_data;
  1652. assign tr_data = 0;
  1653. endmodule
  1654. // synthesis translate_off
  1655. `timescale 1ns / 1ps
  1656. // synthesis translate_on
  1657. // turn off superfluous verilog processor warnings
  1658. // altera message_level Level1
  1659. // altera message_off 10034 10035 10036 10037 10230 10240 10030
  1660. module nios2_uc_nios2_cpu_nios2_oci_im (
  1661. // inputs:
  1662. clk,
  1663. jrst_n,
  1664. trc_ctrl,
  1665. tw,
  1666. // outputs:
  1667. tracemem_on,
  1668. tracemem_trcdata,
  1669. tracemem_tw,
  1670. trc_im_addr,
  1671. trc_wrap,
  1672. xbrk_wrap_traceoff
  1673. )
  1674. ;
  1675. output tracemem_on;
  1676. output [ 35: 0] tracemem_trcdata;
  1677. output tracemem_tw;
  1678. output [ 6: 0] trc_im_addr;
  1679. output trc_wrap;
  1680. output xbrk_wrap_traceoff;
  1681. input clk;
  1682. input jrst_n;
  1683. input [ 15: 0] trc_ctrl;
  1684. input [ 35: 0] tw;
  1685. wire tracemem_on;
  1686. wire [ 35: 0] tracemem_trcdata;
  1687. wire tracemem_tw;
  1688. reg [ 6: 0] trc_im_addr /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,D103,R101\"" */;
  1689. wire [ 35: 0] trc_im_data;
  1690. wire trc_on_chip;
  1691. reg trc_wrap /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,D103,R101\"" */;
  1692. wire tw_valid;
  1693. wire xbrk_wrap_traceoff;
  1694. assign trc_im_data = tw;
  1695. always @(posedge clk or negedge jrst_n)
  1696. begin
  1697. if (jrst_n == 0)
  1698. begin
  1699. trc_im_addr <= 0;
  1700. trc_wrap <= 0;
  1701. end
  1702. else
  1703. begin
  1704. trc_im_addr <= 0;
  1705. trc_wrap <= 0;
  1706. end
  1707. end
  1708. assign trc_on_chip = ~trc_ctrl[8];
  1709. assign tw_valid = |trc_im_data[35 : 32];
  1710. assign xbrk_wrap_traceoff = trc_ctrl[10] & trc_wrap;
  1711. assign tracemem_trcdata = 0;
  1712. endmodule
  1713. // synthesis translate_off
  1714. `timescale 1ns / 1ps
  1715. // synthesis translate_on
  1716. // turn off superfluous verilog processor warnings
  1717. // altera message_level Level1
  1718. // altera message_off 10034 10035 10036 10037 10230 10240 10030
  1719. module nios2_uc_nios2_cpu_nios2_performance_monitors
  1720. ;
  1721. endmodule
  1722. // synthesis translate_off
  1723. `timescale 1ns / 1ps
  1724. // synthesis translate_on
  1725. // turn off superfluous verilog processor warnings
  1726. // altera message_level Level1
  1727. // altera message_off 10034 10035 10036 10037 10230 10240 10030
  1728. module nios2_uc_nios2_cpu_nios2_avalon_reg (
  1729. // inputs:
  1730. address,
  1731. clk,
  1732. debugaccess,
  1733. monitor_error,
  1734. monitor_go,
  1735. monitor_ready,
  1736. reset_n,
  1737. write,
  1738. writedata,
  1739. // outputs:
  1740. oci_ienable,
  1741. oci_reg_readdata,
  1742. oci_single_step_mode,
  1743. ocireg_ers,
  1744. ocireg_mrs,
  1745. take_action_ocireg
  1746. )
  1747. ;
  1748. output [ 31: 0] oci_ienable;
  1749. output [ 31: 0] oci_reg_readdata;
  1750. output oci_single_step_mode;
  1751. output ocireg_ers;
  1752. output ocireg_mrs;
  1753. output take_action_ocireg;
  1754. input [ 8: 0] address;
  1755. input clk;
  1756. input debugaccess;
  1757. input monitor_error;
  1758. input monitor_go;
  1759. input monitor_ready;
  1760. input reset_n;
  1761. input write;
  1762. input [ 31: 0] writedata;
  1763. reg [ 31: 0] oci_ienable;
  1764. wire oci_reg_00_addressed;
  1765. wire oci_reg_01_addressed;
  1766. wire [ 31: 0] oci_reg_readdata;
  1767. reg oci_single_step_mode;
  1768. wire ocireg_ers;
  1769. wire ocireg_mrs;
  1770. wire ocireg_sstep;
  1771. wire take_action_oci_intr_mask_reg;
  1772. wire take_action_ocireg;
  1773. wire write_strobe;
  1774. assign oci_reg_00_addressed = address == 9'h100;
  1775. assign oci_reg_01_addressed = address == 9'h101;
  1776. assign write_strobe = write & debugaccess;
  1777. assign take_action_ocireg = write_strobe & oci_reg_00_addressed;
  1778. assign take_action_oci_intr_mask_reg = write_strobe & oci_reg_01_addressed;
  1779. assign ocireg_ers = writedata[1];
  1780. assign ocireg_mrs = writedata[0];
  1781. assign ocireg_sstep = writedata[3];
  1782. assign oci_reg_readdata = oci_reg_00_addressed ? {28'b0, oci_single_step_mode, monitor_go,
  1783. monitor_ready, monitor_error} :
  1784. oci_reg_01_addressed ? oci_ienable :
  1785. 32'b0;
  1786. always @(posedge clk or negedge reset_n)
  1787. begin
  1788. if (reset_n == 0)
  1789. oci_single_step_mode <= 1'b0;
  1790. else if (take_action_ocireg)
  1791. oci_single_step_mode <= ocireg_sstep;
  1792. end
  1793. always @(posedge clk or negedge reset_n)
  1794. begin
  1795. if (reset_n == 0)
  1796. oci_ienable <= 32'b00000000000000000000000000000001;
  1797. else if (take_action_oci_intr_mask_reg)
  1798. oci_ienable <= writedata | ~(32'b00000000000000000000000000000001);
  1799. end
  1800. endmodule
  1801. // synthesis translate_off
  1802. `timescale 1ns / 1ps
  1803. // synthesis translate_on
  1804. // turn off superfluous verilog processor warnings
  1805. // altera message_level Level1
  1806. // altera message_off 10034 10035 10036 10037 10230 10240 10030
  1807. module nios2_uc_nios2_cpu_ociram_sp_ram_module (
  1808. // inputs:
  1809. address,
  1810. byteenable,
  1811. clock,
  1812. data,
  1813. reset_req,
  1814. wren,
  1815. // outputs:
  1816. q
  1817. )
  1818. ;
  1819. parameter lpm_file = "UNUSED";
  1820. output [ 31: 0] q;
  1821. input [ 7: 0] address;
  1822. input [ 3: 0] byteenable;
  1823. input clock;
  1824. input [ 31: 0] data;
  1825. input reset_req;
  1826. input wren;
  1827. wire clocken;
  1828. wire [ 31: 0] q;
  1829. wire [ 31: 0] ram_q;
  1830. assign q = ram_q;
  1831. assign clocken = ~reset_req;
  1832. altsyncram the_altsyncram
  1833. (
  1834. .address_a (address),
  1835. .byteena_a (byteenable),
  1836. .clock0 (clock),
  1837. .clocken0 (clocken),
  1838. .data_a (data),
  1839. .q_a (ram_q),
  1840. .wren_a (wren)
  1841. );
  1842. defparam the_altsyncram.init_file = lpm_file,
  1843. the_altsyncram.maximum_depth = 0,
  1844. the_altsyncram.numwords_a = 256,
  1845. the_altsyncram.operation_mode = "SINGLE_PORT",
  1846. the_altsyncram.outdata_reg_a = "UNREGISTERED",
  1847. the_altsyncram.ram_block_type = "AUTO",
  1848. the_altsyncram.read_during_write_mode_port_a = "DONT_CARE",
  1849. the_altsyncram.width_a = 32,
  1850. the_altsyncram.width_byteena_a = 4,
  1851. the_altsyncram.widthad_a = 8;
  1852. endmodule
  1853. // synthesis translate_off
  1854. `timescale 1ns / 1ps
  1855. // synthesis translate_on
  1856. // turn off superfluous verilog processor warnings
  1857. // altera message_level Level1
  1858. // altera message_off 10034 10035 10036 10037 10230 10240 10030
  1859. module nios2_uc_nios2_cpu_nios2_ocimem (
  1860. // inputs:
  1861. address,
  1862. byteenable,
  1863. clk,
  1864. debugaccess,
  1865. jdo,
  1866. jrst_n,
  1867. read,
  1868. reset_req,
  1869. take_action_ocimem_a,
  1870. take_action_ocimem_b,
  1871. take_no_action_ocimem_a,
  1872. write,
  1873. writedata,
  1874. // outputs:
  1875. MonDReg,
  1876. ociram_readdata,
  1877. waitrequest
  1878. )
  1879. ;
  1880. output [ 31: 0] MonDReg;
  1881. output [ 31: 0] ociram_readdata;
  1882. output waitrequest;
  1883. input [ 8: 0] address;
  1884. input [ 3: 0] byteenable;
  1885. input clk;
  1886. input debugaccess;
  1887. input [ 37: 0] jdo;
  1888. input jrst_n;
  1889. input read;
  1890. input reset_req;
  1891. input take_action_ocimem_a;
  1892. input take_action_ocimem_b;
  1893. input take_no_action_ocimem_a;
  1894. input write;
  1895. input [ 31: 0] writedata;
  1896. reg [ 10: 0] MonAReg /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,D103,R101\"" */;
  1897. wire [ 8: 0] MonARegAddrInc;
  1898. wire MonARegAddrIncAccessingRAM;
  1899. reg [ 31: 0] MonDReg /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,D103,R101\"" */;
  1900. reg avalon_ociram_readdata_ready /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,D103,R101\"" */;
  1901. wire avalon_ram_wr;
  1902. wire [ 31: 0] cfgrom_readdata;
  1903. reg jtag_ram_access /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,D103,R101\"" */;
  1904. reg jtag_ram_rd /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,D103,R101\"" */;
  1905. reg jtag_ram_rd_d1 /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,D103,R101\"" */;
  1906. reg jtag_ram_wr /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,D103,R101\"" */;
  1907. reg jtag_rd /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,D103,R101\"" */;
  1908. reg jtag_rd_d1 /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,D103,R101\"" */;
  1909. wire [ 7: 0] ociram_addr;
  1910. wire [ 3: 0] ociram_byteenable;
  1911. wire [ 31: 0] ociram_readdata;
  1912. wire ociram_reset_req;
  1913. wire [ 31: 0] ociram_wr_data;
  1914. wire ociram_wr_en;
  1915. reg waitrequest /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"D101,D103,R101\"" */;
  1916. always @(posedge clk or negedge jrst_n)
  1917. begin
  1918. if (jrst_n == 0)
  1919. begin
  1920. jtag_rd <= 1'b0;
  1921. jtag_rd_d1 <= 1'b0;
  1922. jtag_ram_wr <= 1'b0;
  1923. jtag_ram_rd <= 1'b0;
  1924. jtag_ram_rd_d1 <= 1'b0;
  1925. jtag_ram_access <= 1'b0;
  1926. MonAReg <= 0;
  1927. MonDReg <= 0;
  1928. waitrequest <= 1'b1;
  1929. avalon_ociram_readdata_ready <= 1'b0;
  1930. end
  1931. else
  1932. begin
  1933. if (take_no_action_ocimem_a)
  1934. begin
  1935. MonAReg[10 : 2] <= MonARegAddrInc;
  1936. jtag_rd <= 1'b1;
  1937. jtag_ram_rd <= MonARegAddrIncAccessingRAM;
  1938. jtag_ram_access <= MonARegAddrIncAccessingRAM;
  1939. end
  1940. else if (take_action_ocimem_a)
  1941. begin
  1942. MonAReg[10 : 2] <= { jdo[17],
  1943. jdo[33 : 26] };
  1944. jtag_rd <= 1'b1;
  1945. jtag_ram_rd <= ~jdo[17];
  1946. jtag_ram_access <= ~jdo[17];
  1947. end
  1948. else if (take_action_ocimem_b)
  1949. begin
  1950. MonAReg[10 : 2] <= MonARegAddrInc;
  1951. MonDReg <= jdo[34 : 3];
  1952. jtag_ram_wr <= MonARegAddrIncAccessingRAM;
  1953. jtag_ram_access <= MonARegAddrIncAccessingRAM;
  1954. end
  1955. else
  1956. begin
  1957. jtag_rd <= 0;
  1958. jtag_ram_wr <= 0;
  1959. jtag_ram_rd <= 0;
  1960. jtag_ram_access <= 0;
  1961. if (jtag_rd_d1)
  1962. MonDReg <= jtag_ram_rd_d1 ? ociram_readdata : cfgrom_readdata;
  1963. end
  1964. jtag_rd_d1 <= jtag_rd;
  1965. jtag_ram_rd_d1 <= jtag_ram_rd;
  1966. if (~waitrequest)
  1967. begin
  1968. waitrequest <= 1'b1;
  1969. avalon_ociram_readdata_ready <= 1'b0;
  1970. end
  1971. else if (write)
  1972. waitrequest <= ~address[8] & jtag_ram_access;
  1973. else if (read)
  1974. begin
  1975. avalon_ociram_readdata_ready <= ~(~address[8] & jtag_ram_access);
  1976. waitrequest <= ~avalon_ociram_readdata_ready;
  1977. end
  1978. else
  1979. begin
  1980. waitrequest <= 1'b1;
  1981. avalon_ociram_readdata_ready <= 1'b0;
  1982. end
  1983. end
  1984. end
  1985. assign MonARegAddrInc = MonAReg[10 : 2]+1;
  1986. assign MonARegAddrIncAccessingRAM = ~MonARegAddrInc[8];
  1987. assign avalon_ram_wr = write & ~address[8] & debugaccess;
  1988. assign ociram_addr = jtag_ram_access ? MonAReg[9 : 2] : address[7 : 0];
  1989. assign ociram_wr_data = jtag_ram_access ? MonDReg[31 : 0] : writedata;
  1990. assign ociram_byteenable = jtag_ram_access ? 4'b1111 : byteenable;
  1991. assign ociram_wr_en = jtag_ram_access ? jtag_ram_wr : avalon_ram_wr;
  1992. assign ociram_reset_req = reset_req & ~jtag_ram_access;
  1993. //nios2_uc_nios2_cpu_ociram_sp_ram, which is an nios_sp_ram
  1994. nios2_uc_nios2_cpu_ociram_sp_ram_module nios2_uc_nios2_cpu_ociram_sp_ram
  1995. (
  1996. .address (ociram_addr),
  1997. .byteenable (ociram_byteenable),
  1998. .clock (clk),
  1999. .data (ociram_wr_data),
  2000. .q (ociram_readdata),
  2001. .reset_req (ociram_reset_req),
  2002. .wren (ociram_wr_en)
  2003. );
  2004. //synthesis translate_off
  2005. `ifdef NO_PLI
  2006. defparam nios2_uc_nios2_cpu_ociram_sp_ram.lpm_file = "nios2_uc_nios2_cpu_ociram_default_contents.dat";
  2007. `else
  2008. defparam nios2_uc_nios2_cpu_ociram_sp_ram.lpm_file = "nios2_uc_nios2_cpu_ociram_default_contents.hex";
  2009. `endif
  2010. //synthesis translate_on
  2011. assign cfgrom_readdata = (MonAReg[4 : 2] == 3'd0)? 32'h00040020 :
  2012. (MonAReg[4 : 2] == 3'd1)? 32'h00001414 :
  2013. (MonAReg[4 : 2] == 3'd2)? 32'h00040000 :
  2014. (MonAReg[4 : 2] == 3'd3)? 32'h00000100 :
  2015. (MonAReg[4 : 2] == 3'd4)? 32'h20000000 :
  2016. (MonAReg[4 : 2] == 3'd5)? 32'h00040000 :
  2017. (MonAReg[4 : 2] == 3'd6)? 32'h00000000 :
  2018. 32'h00000000;
  2019. endmodule
  2020. // synthesis translate_off
  2021. `timescale 1ns / 1ps
  2022. // synthesis translate_on
  2023. // turn off superfluous verilog processor warnings
  2024. // altera message_level Level1
  2025. // altera message_off 10034 10035 10036 10037 10230 10240 10030
  2026. module nios2_uc_nios2_cpu_nios2_oci (
  2027. // inputs:
  2028. D_valid,
  2029. E_st_data,
  2030. E_valid,
  2031. F_pc,
  2032. address_nxt,
  2033. av_ld_data_aligned_filtered,
  2034. byteenable_nxt,
  2035. clk,
  2036. d_address,
  2037. d_read,
  2038. d_waitrequest,
  2039. d_write,
  2040. debugaccess_nxt,
  2041. hbreak_enabled,
  2042. read_nxt,
  2043. reset,
  2044. reset_n,
  2045. reset_req,
  2046. write_nxt,
  2047. writedata_nxt,
  2048. // outputs:
  2049. debug_mem_slave_debugaccess_to_roms,
  2050. oci_hbreak_req,
  2051. oci_ienable,
  2052. oci_single_step_mode,
  2053. readdata,
  2054. resetrequest,
  2055. waitrequest
  2056. )
  2057. ;
  2058. output debug_mem_slave_debugaccess_to_roms;
  2059. output oci_hbreak_req;
  2060. output [ 31: 0] oci_ienable;
  2061. output oci_single_step_mode;
  2062. output [ 31: 0] readdata;
  2063. output resetrequest;
  2064. output waitrequest;
  2065. input D_valid;
  2066. input [ 31: 0] E_st_data;
  2067. input E_valid;
  2068. input [ 17: 0] F_pc;
  2069. input [ 8: 0] address_nxt;
  2070. input [ 31: 0] av_ld_data_aligned_filtered;
  2071. input [ 3: 0] byteenable_nxt;
  2072. input clk;
  2073. input [ 19: 0] d_address;
  2074. input d_read;
  2075. input d_waitrequest;
  2076. input d_write;
  2077. input debugaccess_nxt;
  2078. input hbreak_enabled;
  2079. input read_nxt;
  2080. input reset;
  2081. input reset_n;
  2082. input reset_req;
  2083. input write_nxt;
  2084. input [ 31: 0] writedata_nxt;
  2085. wire [ 31: 0] MonDReg;
  2086. reg [ 8: 0] address;
  2087. wire [ 35: 0] atm;
  2088. wire [ 31: 0] break_readreg;
  2089. reg [ 3: 0] byteenable;
  2090. wire [ 19: 0] cpu_d_address;
  2091. wire cpu_d_read;
  2092. wire [ 31: 0] cpu_d_readdata;
  2093. wire cpu_d_wait;
  2094. wire cpu_d_write;
  2095. wire [ 31: 0] cpu_d_writedata;
  2096. wire dbrk_break;
  2097. wire dbrk_goto0;
  2098. wire dbrk_goto1;
  2099. wire dbrk_hit0_latch;
  2100. wire dbrk_hit1_latch;
  2101. wire dbrk_hit2_latch;
  2102. wire dbrk_hit3_latch;
  2103. wire dbrk_traceme;
  2104. wire dbrk_traceoff;
  2105. wire dbrk_traceon;
  2106. wire dbrk_trigout;
  2107. wire debug_mem_slave_debugaccess_to_roms;
  2108. reg debugaccess;
  2109. wire debugack;
  2110. wire debugreq;
  2111. wire [ 35: 0] dtm;
  2112. wire dummy_sink;
  2113. wire [ 35: 0] itm;
  2114. wire [ 37: 0] jdo;
  2115. wire jrst_n;
  2116. wire monitor_error;
  2117. wire monitor_go;
  2118. wire monitor_ready;
  2119. wire oci_hbreak_req;
  2120. wire [ 31: 0] oci_ienable;
  2121. wire [ 31: 0] oci_reg_readdata;
  2122. wire oci_single_step_mode;
  2123. wire [ 31: 0] ociram_readdata;
  2124. wire ocireg_ers;
  2125. wire ocireg_mrs;
  2126. reg read;
  2127. reg [ 31: 0] readdata;
  2128. wire resetlatch;
  2129. wire resetrequest;
  2130. wire st_ready_test_idle;
  2131. wire take_action_break_a;
  2132. wire take_action_break_b;
  2133. wire take_action_break_c;
  2134. wire take_action_ocimem_a;
  2135. wire take_action_ocimem_b;
  2136. wire take_action_ocireg;
  2137. wire take_action_tracectrl;
  2138. wire take_no_action_break_a;
  2139. wire take_no_action_break_b;
  2140. wire take_no_action_break_c;
  2141. wire take_no_action_ocimem_a;
  2142. wire [ 35: 0] tr_data;
  2143. wire tracemem_on;
  2144. wire [ 35: 0] tracemem_trcdata;
  2145. wire tracemem_tw;
  2146. wire [ 15: 0] trc_ctrl;
  2147. wire [ 6: 0] trc_im_addr;
  2148. wire trc_on;
  2149. wire trc_wrap;
  2150. wire trigbrktype;
  2151. wire trigger_state_0;
  2152. wire trigger_state_1;
  2153. wire trigout;
  2154. wire [ 35: 0] tw;
  2155. wire waitrequest;
  2156. reg write;
  2157. reg [ 31: 0] writedata;
  2158. wire xbrk_break;
  2159. wire [ 7: 0] xbrk_ctrl0;
  2160. wire [ 7: 0] xbrk_ctrl1;
  2161. wire [ 7: 0] xbrk_ctrl2;
  2162. wire [ 7: 0] xbrk_ctrl3;
  2163. wire xbrk_goto0;
  2164. wire xbrk_goto1;
  2165. wire xbrk_traceoff;
  2166. wire xbrk_traceon;
  2167. wire xbrk_trigout;
  2168. wire xbrk_wrap_traceoff;
  2169. nios2_uc_nios2_cpu_nios2_oci_debug the_nios2_uc_nios2_cpu_nios2_oci_debug
  2170. (
  2171. .clk (clk),
  2172. .dbrk_break (dbrk_break),
  2173. .debugack (debugack),
  2174. .debugreq (debugreq),
  2175. .hbreak_enabled (hbreak_enabled),
  2176. .jdo (jdo),
  2177. .jrst_n (jrst_n),
  2178. .monitor_error (monitor_error),
  2179. .monitor_go (monitor_go),
  2180. .monitor_ready (monitor_ready),
  2181. .oci_hbreak_req (oci_hbreak_req),
  2182. .ocireg_ers (ocireg_ers),
  2183. .ocireg_mrs (ocireg_mrs),
  2184. .reset (reset),
  2185. .resetlatch (resetlatch),
  2186. .resetrequest (resetrequest),
  2187. .st_ready_test_idle (st_ready_test_idle),
  2188. .take_action_ocimem_a (take_action_ocimem_a),
  2189. .take_action_ocireg (take_action_ocireg),
  2190. .xbrk_break (xbrk_break)
  2191. );
  2192. nios2_uc_nios2_cpu_nios2_oci_break the_nios2_uc_nios2_cpu_nios2_oci_break
  2193. (
  2194. .break_readreg (break_readreg),
  2195. .clk (clk),
  2196. .dbrk_break (dbrk_break),
  2197. .dbrk_goto0 (dbrk_goto0),
  2198. .dbrk_goto1 (dbrk_goto1),
  2199. .dbrk_hit0_latch (dbrk_hit0_latch),
  2200. .dbrk_hit1_latch (dbrk_hit1_latch),
  2201. .dbrk_hit2_latch (dbrk_hit2_latch),
  2202. .dbrk_hit3_latch (dbrk_hit3_latch),
  2203. .jdo (jdo),
  2204. .jrst_n (jrst_n),
  2205. .take_action_break_a (take_action_break_a),
  2206. .take_action_break_b (take_action_break_b),
  2207. .take_action_break_c (take_action_break_c),
  2208. .take_no_action_break_a (take_no_action_break_a),
  2209. .take_no_action_break_b (take_no_action_break_b),
  2210. .take_no_action_break_c (take_no_action_break_c),
  2211. .trigbrktype (trigbrktype),
  2212. .trigger_state_0 (trigger_state_0),
  2213. .trigger_state_1 (trigger_state_1),
  2214. .xbrk_ctrl0 (xbrk_ctrl0),
  2215. .xbrk_ctrl1 (xbrk_ctrl1),
  2216. .xbrk_ctrl2 (xbrk_ctrl2),
  2217. .xbrk_ctrl3 (xbrk_ctrl3),
  2218. .xbrk_goto0 (xbrk_goto0),
  2219. .xbrk_goto1 (xbrk_goto1)
  2220. );
  2221. nios2_uc_nios2_cpu_nios2_oci_xbrk the_nios2_uc_nios2_cpu_nios2_oci_xbrk
  2222. (
  2223. .D_valid (D_valid),
  2224. .E_valid (E_valid),
  2225. .F_pc (F_pc),
  2226. .clk (clk),
  2227. .reset_n (reset_n),
  2228. .trigger_state_0 (trigger_state_0),
  2229. .trigger_state_1 (trigger_state_1),
  2230. .xbrk_break (xbrk_break),
  2231. .xbrk_ctrl0 (xbrk_ctrl0),
  2232. .xbrk_ctrl1 (xbrk_ctrl1),
  2233. .xbrk_ctrl2 (xbrk_ctrl2),
  2234. .xbrk_ctrl3 (xbrk_ctrl3),
  2235. .xbrk_goto0 (xbrk_goto0),
  2236. .xbrk_goto1 (xbrk_goto1),
  2237. .xbrk_traceoff (xbrk_traceoff),
  2238. .xbrk_traceon (xbrk_traceon),
  2239. .xbrk_trigout (xbrk_trigout)
  2240. );
  2241. nios2_uc_nios2_cpu_nios2_oci_dbrk the_nios2_uc_nios2_cpu_nios2_oci_dbrk
  2242. (
  2243. .E_st_data (E_st_data),
  2244. .av_ld_data_aligned_filtered (av_ld_data_aligned_filtered),
  2245. .clk (clk),
  2246. .cpu_d_address (cpu_d_address),
  2247. .cpu_d_read (cpu_d_read),
  2248. .cpu_d_readdata (cpu_d_readdata),
  2249. .cpu_d_wait (cpu_d_wait),
  2250. .cpu_d_write (cpu_d_write),
  2251. .cpu_d_writedata (cpu_d_writedata),
  2252. .d_address (d_address),
  2253. .d_read (d_read),
  2254. .d_waitrequest (d_waitrequest),
  2255. .d_write (d_write),
  2256. .dbrk_break (dbrk_break),
  2257. .dbrk_goto0 (dbrk_goto0),
  2258. .dbrk_goto1 (dbrk_goto1),
  2259. .dbrk_traceme (dbrk_traceme),
  2260. .dbrk_traceoff (dbrk_traceoff),
  2261. .dbrk_traceon (dbrk_traceon),
  2262. .dbrk_trigout (dbrk_trigout),
  2263. .debugack (debugack),
  2264. .reset_n (reset_n)
  2265. );
  2266. nios2_uc_nios2_cpu_nios2_oci_itrace the_nios2_uc_nios2_cpu_nios2_oci_itrace
  2267. (
  2268. .clk (clk),
  2269. .dbrk_traceoff (dbrk_traceoff),
  2270. .dbrk_traceon (dbrk_traceon),
  2271. .itm (itm),
  2272. .jdo (jdo),
  2273. .jrst_n (jrst_n),
  2274. .take_action_tracectrl (take_action_tracectrl),
  2275. .trc_ctrl (trc_ctrl),
  2276. .trc_on (trc_on),
  2277. .xbrk_traceoff (xbrk_traceoff),
  2278. .xbrk_traceon (xbrk_traceon),
  2279. .xbrk_wrap_traceoff (xbrk_wrap_traceoff)
  2280. );
  2281. nios2_uc_nios2_cpu_nios2_oci_dtrace the_nios2_uc_nios2_cpu_nios2_oci_dtrace
  2282. (
  2283. .atm (atm),
  2284. .clk (clk),
  2285. .cpu_d_address (cpu_d_address),
  2286. .cpu_d_read (cpu_d_read),
  2287. .cpu_d_readdata (cpu_d_readdata),
  2288. .cpu_d_wait (cpu_d_wait),
  2289. .cpu_d_write (cpu_d_write),
  2290. .cpu_d_writedata (cpu_d_writedata),
  2291. .dtm (dtm),
  2292. .jrst_n (jrst_n),
  2293. .trc_ctrl (trc_ctrl)
  2294. );
  2295. nios2_uc_nios2_cpu_nios2_oci_fifo the_nios2_uc_nios2_cpu_nios2_oci_fifo
  2296. (
  2297. .atm (atm),
  2298. .clk (clk),
  2299. .dbrk_traceme (dbrk_traceme),
  2300. .dbrk_traceoff (dbrk_traceoff),
  2301. .dbrk_traceon (dbrk_traceon),
  2302. .dtm (dtm),
  2303. .itm (itm),
  2304. .jrst_n (jrst_n),
  2305. .reset_n (reset_n),
  2306. .trc_on (trc_on),
  2307. .tw (tw)
  2308. );
  2309. nios2_uc_nios2_cpu_nios2_oci_pib the_nios2_uc_nios2_cpu_nios2_oci_pib
  2310. (
  2311. .tr_data (tr_data)
  2312. );
  2313. nios2_uc_nios2_cpu_nios2_oci_im the_nios2_uc_nios2_cpu_nios2_oci_im
  2314. (
  2315. .clk (clk),
  2316. .jrst_n (jrst_n),
  2317. .tracemem_on (tracemem_on),
  2318. .tracemem_trcdata (tracemem_trcdata),
  2319. .tracemem_tw (tracemem_tw),
  2320. .trc_ctrl (trc_ctrl),
  2321. .trc_im_addr (trc_im_addr),
  2322. .trc_wrap (trc_wrap),
  2323. .tw (tw),
  2324. .xbrk_wrap_traceoff (xbrk_wrap_traceoff)
  2325. );
  2326. nios2_uc_nios2_cpu_nios2_avalon_reg the_nios2_uc_nios2_cpu_nios2_avalon_reg
  2327. (
  2328. .address (address),
  2329. .clk (clk),
  2330. .debugaccess (debugaccess),
  2331. .monitor_error (monitor_error),
  2332. .monitor_go (monitor_go),
  2333. .monitor_ready (monitor_ready),
  2334. .oci_ienable (oci_ienable),
  2335. .oci_reg_readdata (oci_reg_readdata),
  2336. .oci_single_step_mode (oci_single_step_mode),
  2337. .ocireg_ers (ocireg_ers),
  2338. .ocireg_mrs (ocireg_mrs),
  2339. .reset_n (reset_n),
  2340. .take_action_ocireg (take_action_ocireg),
  2341. .write (write),
  2342. .writedata (writedata)
  2343. );
  2344. nios2_uc_nios2_cpu_nios2_ocimem the_nios2_uc_nios2_cpu_nios2_ocimem
  2345. (
  2346. .MonDReg (MonDReg),
  2347. .address (address),
  2348. .byteenable (byteenable),
  2349. .clk (clk),
  2350. .debugaccess (debugaccess),
  2351. .jdo (jdo),
  2352. .jrst_n (jrst_n),
  2353. .ociram_readdata (ociram_readdata),
  2354. .read (read),
  2355. .reset_req (reset_req),
  2356. .take_action_ocimem_a (take_action_ocimem_a),
  2357. .take_action_ocimem_b (take_action_ocimem_b),
  2358. .take_no_action_ocimem_a (take_no_action_ocimem_a),
  2359. .waitrequest (waitrequest),
  2360. .write (write),
  2361. .writedata (writedata)
  2362. );
  2363. assign trigout = dbrk_trigout | xbrk_trigout;
  2364. assign debug_mem_slave_debugaccess_to_roms = debugack;
  2365. always @(posedge clk or negedge jrst_n)
  2366. begin
  2367. if (jrst_n == 0)
  2368. address <= 0;
  2369. else
  2370. address <= address_nxt;
  2371. end
  2372. always @(posedge clk or negedge jrst_n)
  2373. begin
  2374. if (jrst_n == 0)
  2375. byteenable <= 0;
  2376. else
  2377. byteenable <= byteenable_nxt;
  2378. end
  2379. always @(posedge clk or negedge jrst_n)
  2380. begin
  2381. if (jrst_n == 0)
  2382. writedata <= 0;
  2383. else
  2384. writedata <= writedata_nxt;
  2385. end
  2386. always @(posedge clk or negedge jrst_n)
  2387. begin
  2388. if (jrst_n == 0)
  2389. debugaccess <= 0;
  2390. else
  2391. debugaccess <= debugaccess_nxt;
  2392. end
  2393. always @(posedge clk or negedge jrst_n)
  2394. begin
  2395. if (jrst_n == 0)
  2396. read <= 0;
  2397. else
  2398. read <= read ? waitrequest : read_nxt;
  2399. end
  2400. always @(posedge clk or negedge jrst_n)
  2401. begin
  2402. if (jrst_n == 0)
  2403. write <= 0;
  2404. else
  2405. write <= write ? waitrequest : write_nxt;
  2406. end
  2407. always @(posedge clk or negedge jrst_n)
  2408. begin
  2409. if (jrst_n == 0)
  2410. readdata <= 0;
  2411. else
  2412. readdata <= address[8] ? oci_reg_readdata : ociram_readdata;
  2413. end
  2414. nios2_uc_nios2_cpu_debug_slave_wrapper the_nios2_uc_nios2_cpu_debug_slave_wrapper
  2415. (
  2416. .MonDReg (MonDReg),
  2417. .break_readreg (break_readreg),
  2418. .clk (clk),
  2419. .dbrk_hit0_latch (dbrk_hit0_latch),
  2420. .dbrk_hit1_latch (dbrk_hit1_latch),
  2421. .dbrk_hit2_latch (dbrk_hit2_latch),
  2422. .dbrk_hit3_latch (dbrk_hit3_latch),
  2423. .debugack (debugack),
  2424. .jdo (jdo),
  2425. .jrst_n (jrst_n),
  2426. .monitor_error (monitor_error),
  2427. .monitor_ready (monitor_ready),
  2428. .reset_n (reset_n),
  2429. .resetlatch (resetlatch),
  2430. .st_ready_test_idle (st_ready_test_idle),
  2431. .take_action_break_a (take_action_break_a),
  2432. .take_action_break_b (take_action_break_b),
  2433. .take_action_break_c (take_action_break_c),
  2434. .take_action_ocimem_a (take_action_ocimem_a),
  2435. .take_action_ocimem_b (take_action_ocimem_b),
  2436. .take_action_tracectrl (take_action_tracectrl),
  2437. .take_no_action_break_a (take_no_action_break_a),
  2438. .take_no_action_break_b (take_no_action_break_b),
  2439. .take_no_action_break_c (take_no_action_break_c),
  2440. .take_no_action_ocimem_a (take_no_action_ocimem_a),
  2441. .tracemem_on (tracemem_on),
  2442. .tracemem_trcdata (tracemem_trcdata),
  2443. .tracemem_tw (tracemem_tw),
  2444. .trc_im_addr (trc_im_addr),
  2445. .trc_on (trc_on),
  2446. .trc_wrap (trc_wrap),
  2447. .trigbrktype (trigbrktype),
  2448. .trigger_state_1 (trigger_state_1)
  2449. );
  2450. //dummy sink, which is an e_mux
  2451. assign dummy_sink = tr_data |
  2452. trigout |
  2453. debugack;
  2454. assign debugreq = 0;
  2455. endmodule
  2456. // synthesis translate_off
  2457. `timescale 1ns / 1ps
  2458. // synthesis translate_on
  2459. // turn off superfluous verilog processor warnings
  2460. // altera message_level Level1
  2461. // altera message_off 10034 10035 10036 10037 10230 10240 10030
  2462. module nios2_uc_nios2_cpu (
  2463. // inputs:
  2464. E_ci_multi_done,
  2465. E_ci_result,
  2466. clk,
  2467. d_readdata,
  2468. d_waitrequest,
  2469. debug_mem_slave_address,
  2470. debug_mem_slave_byteenable,
  2471. debug_mem_slave_debugaccess,
  2472. debug_mem_slave_read,
  2473. debug_mem_slave_write,
  2474. debug_mem_slave_writedata,
  2475. i_readdata,
  2476. i_waitrequest,
  2477. irq,
  2478. reset_n,
  2479. reset_req,
  2480. // outputs:
  2481. D_ci_a,
  2482. D_ci_b,
  2483. D_ci_c,
  2484. D_ci_n,
  2485. D_ci_readra,
  2486. D_ci_readrb,
  2487. D_ci_writerc,
  2488. E_ci_dataa,
  2489. E_ci_datab,
  2490. E_ci_multi_clk_en,
  2491. E_ci_multi_clock,
  2492. E_ci_multi_reset,
  2493. E_ci_multi_reset_req,
  2494. E_ci_multi_start,
  2495. W_ci_estatus,
  2496. W_ci_ipending,
  2497. W_ci_status,
  2498. d_address,
  2499. d_byteenable,
  2500. d_read,
  2501. d_write,
  2502. d_writedata,
  2503. debug_mem_slave_debugaccess_to_roms,
  2504. debug_mem_slave_readdata,
  2505. debug_mem_slave_waitrequest,
  2506. debug_reset_request,
  2507. i_address,
  2508. i_read
  2509. )
  2510. ;
  2511. output [ 4: 0] D_ci_a;
  2512. output [ 4: 0] D_ci_b;
  2513. output [ 4: 0] D_ci_c;
  2514. output [ 7: 0] D_ci_n;
  2515. output D_ci_readra;
  2516. output D_ci_readrb;
  2517. output D_ci_writerc;
  2518. output [ 31: 0] E_ci_dataa;
  2519. output [ 31: 0] E_ci_datab;
  2520. output E_ci_multi_clk_en;
  2521. output E_ci_multi_clock;
  2522. output E_ci_multi_reset;
  2523. output E_ci_multi_reset_req;
  2524. output E_ci_multi_start;
  2525. output W_ci_estatus;
  2526. output [ 31: 0] W_ci_ipending;
  2527. output W_ci_status;
  2528. output [ 19: 0] d_address;
  2529. output [ 3: 0] d_byteenable;
  2530. output d_read;
  2531. output d_write;
  2532. output [ 31: 0] d_writedata;
  2533. output debug_mem_slave_debugaccess_to_roms;
  2534. output [ 31: 0] debug_mem_slave_readdata;
  2535. output debug_mem_slave_waitrequest;
  2536. output debug_reset_request;
  2537. output [ 19: 0] i_address;
  2538. output i_read;
  2539. input E_ci_multi_done;
  2540. input [ 31: 0] E_ci_result;
  2541. input clk;
  2542. input [ 31: 0] d_readdata;
  2543. input d_waitrequest;
  2544. input [ 8: 0] debug_mem_slave_address;
  2545. input [ 3: 0] debug_mem_slave_byteenable;
  2546. input debug_mem_slave_debugaccess;
  2547. input debug_mem_slave_read;
  2548. input debug_mem_slave_write;
  2549. input [ 31: 0] debug_mem_slave_writedata;
  2550. input [ 31: 0] i_readdata;
  2551. input i_waitrequest;
  2552. input [ 31: 0] irq;
  2553. input reset_n;
  2554. input reset_req;
  2555. reg A_valid_from_M /* synthesis ALTERA_IP_DEBUG_VISIBLE = 1 */;
  2556. wire [ 4: 0] D_ci_a;
  2557. wire [ 4: 0] D_ci_b;
  2558. wire [ 4: 0] D_ci_c;
  2559. wire [ 7: 0] D_ci_n;
  2560. wire D_ci_readra;
  2561. wire D_ci_readrb;
  2562. wire D_ci_writerc;
  2563. wire [ 1: 0] D_compare_op;
  2564. wire D_ctrl_alu_force_and;
  2565. wire D_ctrl_alu_force_xor;
  2566. wire D_ctrl_alu_signed_comparison;
  2567. wire D_ctrl_alu_subtract;
  2568. wire D_ctrl_b_is_dst;
  2569. wire D_ctrl_br;
  2570. wire D_ctrl_br_cmp;
  2571. wire D_ctrl_br_uncond;
  2572. wire D_ctrl_break;
  2573. wire D_ctrl_crst;
  2574. wire D_ctrl_custom;
  2575. wire D_ctrl_custom_multi;
  2576. wire D_ctrl_exception;
  2577. wire D_ctrl_force_src2_zero;
  2578. wire D_ctrl_hi_imm16;
  2579. wire D_ctrl_ignore_dst;
  2580. wire D_ctrl_implicit_dst_eretaddr;
  2581. wire D_ctrl_implicit_dst_retaddr;
  2582. wire D_ctrl_intr_inst;
  2583. wire D_ctrl_jmp_direct;
  2584. wire D_ctrl_jmp_indirect;
  2585. wire D_ctrl_ld;
  2586. wire D_ctrl_ld_ex;
  2587. wire D_ctrl_ld_io;
  2588. wire D_ctrl_ld_non_io;
  2589. wire D_ctrl_ld_signed;
  2590. wire D_ctrl_ld_st_ex;
  2591. wire D_ctrl_logic;
  2592. wire D_ctrl_mem16;
  2593. wire D_ctrl_mem32;
  2594. wire D_ctrl_mem8;
  2595. wire D_ctrl_rd_ctl_reg;
  2596. wire D_ctrl_retaddr;
  2597. wire D_ctrl_rot_right;
  2598. wire D_ctrl_set_src2_rem_imm;
  2599. wire D_ctrl_shift_logical;
  2600. wire D_ctrl_shift_right_arith;
  2601. wire D_ctrl_shift_rot;
  2602. wire D_ctrl_shift_rot_right;
  2603. wire D_ctrl_signed_imm12;
  2604. wire D_ctrl_src2_choose_imm;
  2605. wire D_ctrl_src_imm5_shift_rot;
  2606. wire D_ctrl_st;
  2607. wire D_ctrl_st_ex;
  2608. wire D_ctrl_uncond_cti_non_br;
  2609. wire D_ctrl_unsigned_lo_imm16;
  2610. wire D_ctrl_wrctl_inst;
  2611. wire [ 4: 0] D_dst_regnum;
  2612. wire [271: 0] D_inst;
  2613. wire D_is_opx_inst;
  2614. reg [ 31: 0] D_iw /* synthesis ALTERA_IP_DEBUG_VISIBLE = 1 */;
  2615. wire [ 4: 0] D_iw_a;
  2616. wire [ 4: 0] D_iw_b;
  2617. wire [ 4: 0] D_iw_c;
  2618. wire [ 4: 0] D_iw_control_regnum;
  2619. wire [ 7: 0] D_iw_custom_n;
  2620. wire D_iw_custom_readra;
  2621. wire D_iw_custom_readrb;
  2622. wire D_iw_custom_writerc;
  2623. wire [ 15: 0] D_iw_imm16;
  2624. wire [ 25: 0] D_iw_imm26;
  2625. wire [ 4: 0] D_iw_imm5;
  2626. wire [ 1: 0] D_iw_memsz;
  2627. wire [ 5: 0] D_iw_op;
  2628. wire [ 5: 0] D_iw_opx;
  2629. wire [ 17: 0] D_jmp_direct_target_waddr;
  2630. wire [ 1: 0] D_logic_op;
  2631. wire [ 1: 0] D_logic_op_raw;
  2632. wire D_mem16;
  2633. wire D_mem32;
  2634. wire D_mem8;
  2635. wire D_op_add;
  2636. wire D_op_addi;
  2637. wire D_op_and;
  2638. wire D_op_andhi;
  2639. wire D_op_andi;
  2640. wire D_op_beq;
  2641. wire D_op_bge;
  2642. wire D_op_bgeu;
  2643. wire D_op_blt;
  2644. wire D_op_bltu;
  2645. wire D_op_bne;
  2646. wire D_op_br;
  2647. wire D_op_break;
  2648. wire D_op_bret;
  2649. wire D_op_call;
  2650. wire D_op_callr;
  2651. wire D_op_cmpeq;
  2652. wire D_op_cmpeqi;
  2653. wire D_op_cmpge;
  2654. wire D_op_cmpgei;
  2655. wire D_op_cmpgeu;
  2656. wire D_op_cmpgeui;
  2657. wire D_op_cmplt;
  2658. wire D_op_cmplti;
  2659. wire D_op_cmpltu;
  2660. wire D_op_cmpltui;
  2661. wire D_op_cmpne;
  2662. wire D_op_cmpnei;
  2663. wire D_op_crst;
  2664. wire D_op_custom;
  2665. wire D_op_div;
  2666. wire D_op_divu;
  2667. wire D_op_eret;
  2668. wire D_op_flushd;
  2669. wire D_op_flushda;
  2670. wire D_op_flushi;
  2671. wire D_op_flushp;
  2672. wire D_op_hbreak;
  2673. wire D_op_initd;
  2674. wire D_op_initda;
  2675. wire D_op_initi;
  2676. wire D_op_intr;
  2677. wire D_op_jmp;
  2678. wire D_op_jmpi;
  2679. wire D_op_ldb;
  2680. wire D_op_ldbio;
  2681. wire D_op_ldbu;
  2682. wire D_op_ldbuio;
  2683. wire D_op_ldh;
  2684. wire D_op_ldhio;
  2685. wire D_op_ldhu;
  2686. wire D_op_ldhuio;
  2687. wire D_op_ldl;
  2688. wire D_op_ldw;
  2689. wire D_op_ldwio;
  2690. wire D_op_mul;
  2691. wire D_op_muli;
  2692. wire D_op_mulxss;
  2693. wire D_op_mulxsu;
  2694. wire D_op_mulxuu;
  2695. wire D_op_nextpc;
  2696. wire D_op_nios_custom_instr_floating_point_0;
  2697. wire D_op_nor;
  2698. wire D_op_op_rsv02;
  2699. wire D_op_op_rsv09;
  2700. wire D_op_op_rsv10;
  2701. wire D_op_op_rsv17;
  2702. wire D_op_op_rsv18;
  2703. wire D_op_op_rsv25;
  2704. wire D_op_op_rsv26;
  2705. wire D_op_op_rsv33;
  2706. wire D_op_op_rsv34;
  2707. wire D_op_op_rsv41;
  2708. wire D_op_op_rsv42;
  2709. wire D_op_op_rsv49;
  2710. wire D_op_op_rsv57;
  2711. wire D_op_op_rsv61;
  2712. wire D_op_op_rsv62;
  2713. wire D_op_op_rsv63;
  2714. wire D_op_opx_rsv00;
  2715. wire D_op_opx_rsv10;
  2716. wire D_op_opx_rsv15;
  2717. wire D_op_opx_rsv17;
  2718. wire D_op_opx_rsv21;
  2719. wire D_op_opx_rsv25;
  2720. wire D_op_opx_rsv33;
  2721. wire D_op_opx_rsv34;
  2722. wire D_op_opx_rsv35;
  2723. wire D_op_opx_rsv42;
  2724. wire D_op_opx_rsv43;
  2725. wire D_op_opx_rsv44;
  2726. wire D_op_opx_rsv47;
  2727. wire D_op_opx_rsv50;
  2728. wire D_op_opx_rsv51;
  2729. wire D_op_opx_rsv55;
  2730. wire D_op_opx_rsv56;
  2731. wire D_op_opx_rsv60;
  2732. wire D_op_opx_rsv63;
  2733. wire D_op_or;
  2734. wire D_op_orhi;
  2735. wire D_op_ori;
  2736. wire D_op_rdctl;
  2737. wire D_op_rdprs;
  2738. wire D_op_ret;
  2739. wire D_op_rol;
  2740. wire D_op_roli;
  2741. wire D_op_ror;
  2742. wire D_op_sll;
  2743. wire D_op_slli;
  2744. wire D_op_sra;
  2745. wire D_op_srai;
  2746. wire D_op_srl;
  2747. wire D_op_srli;
  2748. wire D_op_stb;
  2749. wire D_op_stbio;
  2750. wire D_op_stc;
  2751. wire D_op_sth;
  2752. wire D_op_sthio;
  2753. wire D_op_stw;
  2754. wire D_op_stwio;
  2755. wire D_op_sub;
  2756. wire D_op_sync;
  2757. wire D_op_trap;
  2758. wire D_op_wrctl;
  2759. wire D_op_wrprs;
  2760. wire D_op_xor;
  2761. wire D_op_xorhi;
  2762. wire D_op_xori;
  2763. reg D_valid;
  2764. wire [271: 0] D_vinst;
  2765. wire D_wr_dst_reg;
  2766. wire [ 31: 0] E_alu_result;
  2767. reg E_alu_sub;
  2768. wire [ 32: 0] E_arith_result;
  2769. wire [ 31: 0] E_arith_src1;
  2770. wire [ 31: 0] E_arith_src2;
  2771. wire [ 31: 0] E_ci_dataa;
  2772. wire [ 31: 0] E_ci_datab;
  2773. reg E_ci_multi_clk_en;
  2774. wire E_ci_multi_clock;
  2775. wire E_ci_multi_reset;
  2776. wire E_ci_multi_reset_req;
  2777. wire E_ci_multi_stall;
  2778. reg E_ci_multi_start;
  2779. wire E_cmp_result;
  2780. wire [ 31: 0] E_control_rd_data;
  2781. wire E_eq;
  2782. reg E_invert_arith_src_msb;
  2783. wire E_ld_stall;
  2784. wire [ 31: 0] E_logic_result;
  2785. wire E_logic_result_is_0;
  2786. wire E_lt;
  2787. wire [ 19: 0] E_mem_baddr;
  2788. wire [ 3: 0] E_mem_byte_en;
  2789. reg E_new_inst;
  2790. wire E_rf_ecc_recoverable_valid;
  2791. wire E_rf_ecc_unrecoverable_valid;
  2792. wire E_rf_ecc_valid_any;
  2793. reg [ 4: 0] E_shift_rot_cnt;
  2794. wire [ 4: 0] E_shift_rot_cnt_nxt;
  2795. wire E_shift_rot_done;
  2796. wire E_shift_rot_fill_bit;
  2797. reg [ 31: 0] E_shift_rot_result;
  2798. wire [ 31: 0] E_shift_rot_result_nxt;
  2799. wire [ 4: 0] E_shift_rot_shfcnt;
  2800. wire E_shift_rot_stall;
  2801. reg [ 31: 0] E_src1;
  2802. reg [ 31: 0] E_src2;
  2803. wire [ 31: 0] E_st_data;
  2804. wire E_st_stall;
  2805. wire E_stall;
  2806. wire E_valid;
  2807. reg E_valid_from_R;
  2808. wire [271: 0] E_vinst;
  2809. wire E_wrctl_bstatus;
  2810. wire E_wrctl_estatus;
  2811. wire E_wrctl_ienable;
  2812. wire E_wrctl_status;
  2813. wire [ 31: 0] F_av_iw;
  2814. wire [ 4: 0] F_av_iw_a;
  2815. wire [ 4: 0] F_av_iw_b;
  2816. wire [ 4: 0] F_av_iw_c;
  2817. wire [ 4: 0] F_av_iw_control_regnum;
  2818. wire [ 7: 0] F_av_iw_custom_n;
  2819. wire F_av_iw_custom_readra;
  2820. wire F_av_iw_custom_readrb;
  2821. wire F_av_iw_custom_writerc;
  2822. wire [ 15: 0] F_av_iw_imm16;
  2823. wire [ 25: 0] F_av_iw_imm26;
  2824. wire [ 4: 0] F_av_iw_imm5;
  2825. wire [ 1: 0] F_av_iw_memsz;
  2826. wire [ 5: 0] F_av_iw_op;
  2827. wire [ 5: 0] F_av_iw_opx;
  2828. wire F_av_mem16;
  2829. wire F_av_mem32;
  2830. wire F_av_mem8;
  2831. wire [271: 0] F_inst;
  2832. wire F_is_opx_inst;
  2833. wire [ 31: 0] F_iw;
  2834. wire [ 4: 0] F_iw_a;
  2835. wire [ 4: 0] F_iw_b;
  2836. wire [ 4: 0] F_iw_c;
  2837. wire [ 4: 0] F_iw_control_regnum;
  2838. wire [ 7: 0] F_iw_custom_n;
  2839. wire F_iw_custom_readra;
  2840. wire F_iw_custom_readrb;
  2841. wire F_iw_custom_writerc;
  2842. wire [ 15: 0] F_iw_imm16;
  2843. wire [ 25: 0] F_iw_imm26;
  2844. wire [ 4: 0] F_iw_imm5;
  2845. wire [ 1: 0] F_iw_memsz;
  2846. wire [ 5: 0] F_iw_op;
  2847. wire [ 5: 0] F_iw_opx;
  2848. wire F_mem16;
  2849. wire F_mem32;
  2850. wire F_mem8;
  2851. wire F_op_add;
  2852. wire F_op_addi;
  2853. wire F_op_and;
  2854. wire F_op_andhi;
  2855. wire F_op_andi;
  2856. wire F_op_beq;
  2857. wire F_op_bge;
  2858. wire F_op_bgeu;
  2859. wire F_op_blt;
  2860. wire F_op_bltu;
  2861. wire F_op_bne;
  2862. wire F_op_br;
  2863. wire F_op_break;
  2864. wire F_op_bret;
  2865. wire F_op_call;
  2866. wire F_op_callr;
  2867. wire F_op_cmpeq;
  2868. wire F_op_cmpeqi;
  2869. wire F_op_cmpge;
  2870. wire F_op_cmpgei;
  2871. wire F_op_cmpgeu;
  2872. wire F_op_cmpgeui;
  2873. wire F_op_cmplt;
  2874. wire F_op_cmplti;
  2875. wire F_op_cmpltu;
  2876. wire F_op_cmpltui;
  2877. wire F_op_cmpne;
  2878. wire F_op_cmpnei;
  2879. wire F_op_crst;
  2880. wire F_op_custom;
  2881. wire F_op_div;
  2882. wire F_op_divu;
  2883. wire F_op_eret;
  2884. wire F_op_flushd;
  2885. wire F_op_flushda;
  2886. wire F_op_flushi;
  2887. wire F_op_flushp;
  2888. wire F_op_hbreak;
  2889. wire F_op_initd;
  2890. wire F_op_initda;
  2891. wire F_op_initi;
  2892. wire F_op_intr;
  2893. wire F_op_jmp;
  2894. wire F_op_jmpi;
  2895. wire F_op_ldb;
  2896. wire F_op_ldbio;
  2897. wire F_op_ldbu;
  2898. wire F_op_ldbuio;
  2899. wire F_op_ldh;
  2900. wire F_op_ldhio;
  2901. wire F_op_ldhu;
  2902. wire F_op_ldhuio;
  2903. wire F_op_ldl;
  2904. wire F_op_ldw;
  2905. wire F_op_ldwio;
  2906. wire F_op_mul;
  2907. wire F_op_muli;
  2908. wire F_op_mulxss;
  2909. wire F_op_mulxsu;
  2910. wire F_op_mulxuu;
  2911. wire F_op_nextpc;
  2912. wire F_op_nios_custom_instr_floating_point_0;
  2913. wire F_op_nor;
  2914. wire F_op_op_rsv02;
  2915. wire F_op_op_rsv09;
  2916. wire F_op_op_rsv10;
  2917. wire F_op_op_rsv17;
  2918. wire F_op_op_rsv18;
  2919. wire F_op_op_rsv25;
  2920. wire F_op_op_rsv26;
  2921. wire F_op_op_rsv33;
  2922. wire F_op_op_rsv34;
  2923. wire F_op_op_rsv41;
  2924. wire F_op_op_rsv42;
  2925. wire F_op_op_rsv49;
  2926. wire F_op_op_rsv57;
  2927. wire F_op_op_rsv61;
  2928. wire F_op_op_rsv62;
  2929. wire F_op_op_rsv63;
  2930. wire F_op_opx_rsv00;
  2931. wire F_op_opx_rsv10;
  2932. wire F_op_opx_rsv15;
  2933. wire F_op_opx_rsv17;
  2934. wire F_op_opx_rsv21;
  2935. wire F_op_opx_rsv25;
  2936. wire F_op_opx_rsv33;
  2937. wire F_op_opx_rsv34;
  2938. wire F_op_opx_rsv35;
  2939. wire F_op_opx_rsv42;
  2940. wire F_op_opx_rsv43;
  2941. wire F_op_opx_rsv44;
  2942. wire F_op_opx_rsv47;
  2943. wire F_op_opx_rsv50;
  2944. wire F_op_opx_rsv51;
  2945. wire F_op_opx_rsv55;
  2946. wire F_op_opx_rsv56;
  2947. wire F_op_opx_rsv60;
  2948. wire F_op_opx_rsv63;
  2949. wire F_op_or;
  2950. wire F_op_orhi;
  2951. wire F_op_ori;
  2952. wire F_op_rdctl;
  2953. wire F_op_rdprs;
  2954. wire F_op_ret;
  2955. wire F_op_rol;
  2956. wire F_op_roli;
  2957. wire F_op_ror;
  2958. wire F_op_sll;
  2959. wire F_op_slli;
  2960. wire F_op_sra;
  2961. wire F_op_srai;
  2962. wire F_op_srl;
  2963. wire F_op_srli;
  2964. wire F_op_stb;
  2965. wire F_op_stbio;
  2966. wire F_op_stc;
  2967. wire F_op_sth;
  2968. wire F_op_sthio;
  2969. wire F_op_stw;
  2970. wire F_op_stwio;
  2971. wire F_op_sub;
  2972. wire F_op_sync;
  2973. wire F_op_trap;
  2974. wire F_op_wrctl;
  2975. wire F_op_wrprs;
  2976. wire F_op_xor;
  2977. wire F_op_xorhi;
  2978. wire F_op_xori;
  2979. reg [ 17: 0] F_pc /* synthesis ALTERA_IP_DEBUG_VISIBLE = 1 */;
  2980. wire F_pc_en;
  2981. wire [ 17: 0] F_pc_no_crst_nxt;
  2982. wire [ 17: 0] F_pc_nxt;
  2983. wire [ 17: 0] F_pc_plus_one;
  2984. wire [ 1: 0] F_pc_sel_nxt;
  2985. wire [ 19: 0] F_pcb;
  2986. wire [ 19: 0] F_pcb_nxt;
  2987. wire [ 19: 0] F_pcb_plus_four;
  2988. wire F_valid;
  2989. wire [271: 0] F_vinst;
  2990. reg [ 1: 0] R_compare_op;
  2991. reg R_ctrl_alu_force_and;
  2992. wire R_ctrl_alu_force_and_nxt;
  2993. reg R_ctrl_alu_force_xor;
  2994. wire R_ctrl_alu_force_xor_nxt;
  2995. reg R_ctrl_alu_signed_comparison;
  2996. wire R_ctrl_alu_signed_comparison_nxt;
  2997. reg R_ctrl_alu_subtract;
  2998. wire R_ctrl_alu_subtract_nxt;
  2999. reg R_ctrl_b_is_dst;
  3000. wire R_ctrl_b_is_dst_nxt;
  3001. reg R_ctrl_br;
  3002. reg R_ctrl_br_cmp;
  3003. wire R_ctrl_br_cmp_nxt;
  3004. wire R_ctrl_br_nxt;
  3005. reg R_ctrl_br_uncond;
  3006. wire R_ctrl_br_uncond_nxt;
  3007. reg R_ctrl_break;
  3008. wire R_ctrl_break_nxt;
  3009. reg R_ctrl_crst;
  3010. wire R_ctrl_crst_nxt;
  3011. reg R_ctrl_custom;
  3012. reg R_ctrl_custom_multi;
  3013. wire R_ctrl_custom_multi_nxt;
  3014. wire R_ctrl_custom_nxt;
  3015. reg R_ctrl_exception;
  3016. wire R_ctrl_exception_nxt;
  3017. reg R_ctrl_force_src2_zero;
  3018. wire R_ctrl_force_src2_zero_nxt;
  3019. reg R_ctrl_hi_imm16;
  3020. wire R_ctrl_hi_imm16_nxt;
  3021. reg R_ctrl_ignore_dst;
  3022. wire R_ctrl_ignore_dst_nxt;
  3023. reg R_ctrl_implicit_dst_eretaddr;
  3024. wire R_ctrl_implicit_dst_eretaddr_nxt;
  3025. reg R_ctrl_implicit_dst_retaddr;
  3026. wire R_ctrl_implicit_dst_retaddr_nxt;
  3027. reg R_ctrl_intr_inst;
  3028. wire R_ctrl_intr_inst_nxt;
  3029. reg R_ctrl_jmp_direct;
  3030. wire R_ctrl_jmp_direct_nxt;
  3031. reg R_ctrl_jmp_indirect;
  3032. wire R_ctrl_jmp_indirect_nxt;
  3033. reg R_ctrl_ld;
  3034. reg R_ctrl_ld_ex;
  3035. wire R_ctrl_ld_ex_nxt;
  3036. reg R_ctrl_ld_io;
  3037. wire R_ctrl_ld_io_nxt;
  3038. reg R_ctrl_ld_non_io;
  3039. wire R_ctrl_ld_non_io_nxt;
  3040. wire R_ctrl_ld_nxt;
  3041. reg R_ctrl_ld_signed;
  3042. wire R_ctrl_ld_signed_nxt;
  3043. reg R_ctrl_ld_st_ex;
  3044. wire R_ctrl_ld_st_ex_nxt;
  3045. reg R_ctrl_logic;
  3046. wire R_ctrl_logic_nxt;
  3047. reg R_ctrl_mem16;
  3048. wire R_ctrl_mem16_nxt;
  3049. reg R_ctrl_mem32;
  3050. wire R_ctrl_mem32_nxt;
  3051. reg R_ctrl_mem8;
  3052. wire R_ctrl_mem8_nxt;
  3053. reg R_ctrl_rd_ctl_reg;
  3054. wire R_ctrl_rd_ctl_reg_nxt;
  3055. reg R_ctrl_retaddr;
  3056. wire R_ctrl_retaddr_nxt;
  3057. reg R_ctrl_rot_right;
  3058. wire R_ctrl_rot_right_nxt;
  3059. reg R_ctrl_set_src2_rem_imm;
  3060. wire R_ctrl_set_src2_rem_imm_nxt;
  3061. reg R_ctrl_shift_logical;
  3062. wire R_ctrl_shift_logical_nxt;
  3063. reg R_ctrl_shift_right_arith;
  3064. wire R_ctrl_shift_right_arith_nxt;
  3065. reg R_ctrl_shift_rot;
  3066. wire R_ctrl_shift_rot_nxt;
  3067. reg R_ctrl_shift_rot_right;
  3068. wire R_ctrl_shift_rot_right_nxt;
  3069. reg R_ctrl_signed_imm12;
  3070. wire R_ctrl_signed_imm12_nxt;
  3071. reg R_ctrl_src2_choose_imm;
  3072. wire R_ctrl_src2_choose_imm_nxt;
  3073. reg R_ctrl_src_imm5_shift_rot;
  3074. wire R_ctrl_src_imm5_shift_rot_nxt;
  3075. reg R_ctrl_st;
  3076. reg R_ctrl_st_ex;
  3077. wire R_ctrl_st_ex_nxt;
  3078. wire R_ctrl_st_nxt;
  3079. reg R_ctrl_uncond_cti_non_br;
  3080. wire R_ctrl_uncond_cti_non_br_nxt;
  3081. reg R_ctrl_unsigned_lo_imm16;
  3082. wire R_ctrl_unsigned_lo_imm16_nxt;
  3083. reg R_ctrl_wrctl_inst;
  3084. wire R_ctrl_wrctl_inst_nxt;
  3085. reg [ 4: 0] R_dst_regnum /* synthesis ALTERA_IP_DEBUG_VISIBLE = 1 */;
  3086. wire R_en;
  3087. reg [ 1: 0] R_logic_op;
  3088. wire [ 31: 0] R_rf_a;
  3089. wire [ 31: 0] R_rf_a_q;
  3090. wire [ 31: 0] R_rf_b;
  3091. wire [ 31: 0] R_rf_b_q;
  3092. wire [ 31: 0] R_src1;
  3093. wire [ 31: 0] R_src2;
  3094. wire [ 15: 0] R_src2_hi;
  3095. wire [ 15: 0] R_src2_lo;
  3096. reg R_src2_use_imm;
  3097. wire [ 7: 0] R_stb_data;
  3098. wire [ 15: 0] R_sth_data;
  3099. wire [ 31: 0] R_stw_data;
  3100. reg R_valid;
  3101. wire [271: 0] R_vinst;
  3102. reg R_wr_dst_reg;
  3103. reg W1_rf_ecc_recoverable_valid;
  3104. reg [ 31: 0] W_alu_result;
  3105. wire W_br_taken;
  3106. reg W_bstatus_reg;
  3107. wire W_bstatus_reg_inst_nxt;
  3108. wire W_bstatus_reg_nxt;
  3109. reg [ 31: 0] W_cdsr_reg;
  3110. wire W_ci_estatus;
  3111. wire [ 31: 0] W_ci_ipending;
  3112. wire W_ci_status;
  3113. reg W_cmp_result;
  3114. reg [ 31: 0] W_control_rd_data;
  3115. wire [ 31: 0] W_cpuid_reg;
  3116. wire [ 4: 0] W_dst_regnum;
  3117. reg W_estatus_reg;
  3118. wire W_estatus_reg_inst_nxt;
  3119. wire W_estatus_reg_nxt;
  3120. reg [ 31: 0] W_ienable_reg;
  3121. wire [ 31: 0] W_ienable_reg_nxt;
  3122. reg [ 31: 0] W_ipending_reg;
  3123. wire [ 31: 0] W_ipending_reg_nxt;
  3124. wire [ 19: 0] W_mem_baddr;
  3125. reg W_rf_ecc_recoverable_valid;
  3126. reg W_rf_ecc_unrecoverable_valid;
  3127. wire W_rf_ecc_valid_any;
  3128. wire [ 31: 0] W_rf_wr_data;
  3129. wire W_rf_wren;
  3130. wire W_status_reg;
  3131. reg W_status_reg_pie;
  3132. wire W_status_reg_pie_inst_nxt;
  3133. wire W_status_reg_pie_nxt;
  3134. reg W_up_ex_mon_state;
  3135. reg W_valid /* synthesis ALTERA_IP_DEBUG_VISIBLE = 1 */;
  3136. wire W_valid_from_M;
  3137. wire [271: 0] W_vinst;
  3138. wire [ 31: 0] W_wr_data;
  3139. wire [ 31: 0] W_wr_data_non_zero;
  3140. wire av_fill_bit;
  3141. reg [ 1: 0] av_ld_align_cycle;
  3142. wire [ 1: 0] av_ld_align_cycle_nxt;
  3143. wire av_ld_align_one_more_cycle;
  3144. reg av_ld_aligning_data;
  3145. wire av_ld_aligning_data_nxt;
  3146. reg [ 7: 0] av_ld_byte0_data;
  3147. wire [ 7: 0] av_ld_byte0_data_nxt;
  3148. reg [ 7: 0] av_ld_byte1_data;
  3149. wire av_ld_byte1_data_en;
  3150. wire [ 7: 0] av_ld_byte1_data_nxt;
  3151. reg [ 7: 0] av_ld_byte2_data;
  3152. wire [ 7: 0] av_ld_byte2_data_nxt;
  3153. reg [ 7: 0] av_ld_byte3_data;
  3154. wire [ 7: 0] av_ld_byte3_data_nxt;
  3155. wire [ 31: 0] av_ld_data_aligned_filtered;
  3156. wire [ 31: 0] av_ld_data_aligned_unfiltered;
  3157. wire av_ld_done;
  3158. wire av_ld_extend;
  3159. wire av_ld_getting_data;
  3160. wire av_ld_rshift8;
  3161. reg av_ld_waiting_for_data;
  3162. wire av_ld_waiting_for_data_nxt;
  3163. wire av_sign_bit;
  3164. wire [ 19: 0] d_address;
  3165. reg [ 3: 0] d_byteenable;
  3166. reg d_read;
  3167. wire d_read_nxt;
  3168. reg d_write;
  3169. wire d_write_nxt;
  3170. reg [ 31: 0] d_writedata;
  3171. wire debug_mem_slave_clk;
  3172. wire debug_mem_slave_debugaccess_to_roms;
  3173. wire [ 31: 0] debug_mem_slave_readdata;
  3174. wire debug_mem_slave_reset;
  3175. wire debug_mem_slave_waitrequest;
  3176. wire debug_reset_request;
  3177. reg hbreak_enabled;
  3178. reg hbreak_pending;
  3179. wire hbreak_pending_nxt;
  3180. wire hbreak_req;
  3181. wire [ 19: 0] i_address;
  3182. reg i_read;
  3183. wire i_read_nxt;
  3184. wire [ 31: 0] iactive;
  3185. wire intr_req;
  3186. wire oci_hbreak_req;
  3187. wire [ 31: 0] oci_ienable;
  3188. wire oci_single_step_mode;
  3189. wire oci_tb_hbreak_req;
  3190. wire test_has_ended;
  3191. reg wait_for_one_post_bret_inst;
  3192. //the_nios2_uc_nios2_cpu_test_bench, which is an e_instance
  3193. nios2_uc_nios2_cpu_test_bench the_nios2_uc_nios2_cpu_test_bench
  3194. (
  3195. .D_iw (D_iw),
  3196. .D_iw_op (D_iw_op),
  3197. .D_iw_opx (D_iw_opx),
  3198. .D_valid (D_valid),
  3199. .E_valid (E_valid),
  3200. .F_pcb (F_pcb),
  3201. .F_valid (F_valid),
  3202. .R_ctrl_ld (R_ctrl_ld),
  3203. .R_ctrl_ld_non_io (R_ctrl_ld_non_io),
  3204. .R_dst_regnum (R_dst_regnum),
  3205. .R_wr_dst_reg (R_wr_dst_reg),
  3206. .W_valid (W_valid),
  3207. .W_vinst (W_vinst),
  3208. .W_wr_data (W_wr_data),
  3209. .av_ld_data_aligned_filtered (av_ld_data_aligned_filtered),
  3210. .av_ld_data_aligned_unfiltered (av_ld_data_aligned_unfiltered),
  3211. .clk (clk),
  3212. .d_address (d_address),
  3213. .d_byteenable (d_byteenable),
  3214. .d_read (d_read),
  3215. .d_write (d_write),
  3216. .i_address (i_address),
  3217. .i_read (i_read),
  3218. .i_readdata (i_readdata),
  3219. .i_waitrequest (i_waitrequest),
  3220. .reset_n (reset_n),
  3221. .test_has_ended (test_has_ended)
  3222. );
  3223. assign F_av_iw_a = F_av_iw[31 : 27];
  3224. assign F_av_iw_b = F_av_iw[26 : 22];
  3225. assign F_av_iw_c = F_av_iw[21 : 17];
  3226. assign F_av_iw_custom_n = F_av_iw[13 : 6];
  3227. assign F_av_iw_custom_readra = F_av_iw[16];
  3228. assign F_av_iw_custom_readrb = F_av_iw[15];
  3229. assign F_av_iw_custom_writerc = F_av_iw[14];
  3230. assign F_av_iw_opx = F_av_iw[16 : 11];
  3231. assign F_av_iw_op = F_av_iw[5 : 0];
  3232. assign F_av_iw_imm5 = F_av_iw[10 : 6];
  3233. assign F_av_iw_imm16 = F_av_iw[21 : 6];
  3234. assign F_av_iw_imm26 = F_av_iw[31 : 6];
  3235. assign F_av_iw_memsz = F_av_iw[4 : 3];
  3236. assign F_av_iw_control_regnum = F_av_iw[10 : 6];
  3237. assign F_av_mem8 = F_av_iw_memsz == 2'b00;
  3238. assign F_av_mem16 = F_av_iw_memsz == 2'b01;
  3239. assign F_av_mem32 = F_av_iw_memsz[1] == 1'b1;
  3240. assign F_iw_a = F_iw[31 : 27];
  3241. assign F_iw_b = F_iw[26 : 22];
  3242. assign F_iw_c = F_iw[21 : 17];
  3243. assign F_iw_custom_n = F_iw[13 : 6];
  3244. assign F_iw_custom_readra = F_iw[16];
  3245. assign F_iw_custom_readrb = F_iw[15];
  3246. assign F_iw_custom_writerc = F_iw[14];
  3247. assign F_iw_opx = F_iw[16 : 11];
  3248. assign F_iw_op = F_iw[5 : 0];
  3249. assign F_iw_imm5 = F_iw[10 : 6];
  3250. assign F_iw_imm16 = F_iw[21 : 6];
  3251. assign F_iw_imm26 = F_iw[31 : 6];
  3252. assign F_iw_memsz = F_iw[4 : 3];
  3253. assign F_iw_control_regnum = F_iw[10 : 6];
  3254. assign F_mem8 = F_iw_memsz == 2'b00;
  3255. assign F_mem16 = F_iw_memsz == 2'b01;
  3256. assign F_mem32 = F_iw_memsz[1] == 1'b1;
  3257. assign D_iw_a = D_iw[31 : 27];
  3258. assign D_iw_b = D_iw[26 : 22];
  3259. assign D_iw_c = D_iw[21 : 17];
  3260. assign D_iw_custom_n = D_iw[13 : 6];
  3261. assign D_iw_custom_readra = D_iw[16];
  3262. assign D_iw_custom_readrb = D_iw[15];
  3263. assign D_iw_custom_writerc = D_iw[14];
  3264. assign D_iw_opx = D_iw[16 : 11];
  3265. assign D_iw_op = D_iw[5 : 0];
  3266. assign D_iw_imm5 = D_iw[10 : 6];
  3267. assign D_iw_imm16 = D_iw[21 : 6];
  3268. assign D_iw_imm26 = D_iw[31 : 6];
  3269. assign D_iw_memsz = D_iw[4 : 3];
  3270. assign D_iw_control_regnum = D_iw[10 : 6];
  3271. assign D_mem8 = D_iw_memsz == 2'b00;
  3272. assign D_mem16 = D_iw_memsz == 2'b01;
  3273. assign D_mem32 = D_iw_memsz[1] == 1'b1;
  3274. assign F_op_call = F_iw_op == 0;
  3275. assign F_op_jmpi = F_iw_op == 1;
  3276. assign F_op_op_rsv02 = F_iw_op == 2;
  3277. assign F_op_ldbu = F_iw_op == 3;
  3278. assign F_op_addi = F_iw_op == 4;
  3279. assign F_op_stb = F_iw_op == 5;
  3280. assign F_op_br = F_iw_op == 6;
  3281. assign F_op_ldb = F_iw_op == 7;
  3282. assign F_op_cmpgei = F_iw_op == 8;
  3283. assign F_op_op_rsv09 = F_iw_op == 9;
  3284. assign F_op_op_rsv10 = F_iw_op == 10;
  3285. assign F_op_ldhu = F_iw_op == 11;
  3286. assign F_op_andi = F_iw_op == 12;
  3287. assign F_op_sth = F_iw_op == 13;
  3288. assign F_op_bge = F_iw_op == 14;
  3289. assign F_op_ldh = F_iw_op == 15;
  3290. assign F_op_cmplti = F_iw_op == 16;
  3291. assign F_op_op_rsv17 = F_iw_op == 17;
  3292. assign F_op_op_rsv18 = F_iw_op == 18;
  3293. assign F_op_initda = F_iw_op == 19;
  3294. assign F_op_ori = F_iw_op == 20;
  3295. assign F_op_stw = F_iw_op == 21;
  3296. assign F_op_blt = F_iw_op == 22;
  3297. assign F_op_ldw = F_iw_op == 23;
  3298. assign F_op_cmpnei = F_iw_op == 24;
  3299. assign F_op_op_rsv25 = F_iw_op == 25;
  3300. assign F_op_op_rsv26 = F_iw_op == 26;
  3301. assign F_op_flushda = F_iw_op == 27;
  3302. assign F_op_xori = F_iw_op == 28;
  3303. assign F_op_stc = F_iw_op == 29;
  3304. assign F_op_bne = F_iw_op == 30;
  3305. assign F_op_ldl = F_iw_op == 31;
  3306. assign F_op_cmpeqi = F_iw_op == 32;
  3307. assign F_op_op_rsv33 = F_iw_op == 33;
  3308. assign F_op_op_rsv34 = F_iw_op == 34;
  3309. assign F_op_ldbuio = F_iw_op == 35;
  3310. assign F_op_muli = F_iw_op == 36;
  3311. assign F_op_stbio = F_iw_op == 37;
  3312. assign F_op_beq = F_iw_op == 38;
  3313. assign F_op_ldbio = F_iw_op == 39;
  3314. assign F_op_cmpgeui = F_iw_op == 40;
  3315. assign F_op_op_rsv41 = F_iw_op == 41;
  3316. assign F_op_op_rsv42 = F_iw_op == 42;
  3317. assign F_op_ldhuio = F_iw_op == 43;
  3318. assign F_op_andhi = F_iw_op == 44;
  3319. assign F_op_sthio = F_iw_op == 45;
  3320. assign F_op_bgeu = F_iw_op == 46;
  3321. assign F_op_ldhio = F_iw_op == 47;
  3322. assign F_op_cmpltui = F_iw_op == 48;
  3323. assign F_op_op_rsv49 = F_iw_op == 49;
  3324. assign F_op_custom = F_iw_op == 50;
  3325. assign F_op_initd = F_iw_op == 51;
  3326. assign F_op_orhi = F_iw_op == 52;
  3327. assign F_op_stwio = F_iw_op == 53;
  3328. assign F_op_bltu = F_iw_op == 54;
  3329. assign F_op_ldwio = F_iw_op == 55;
  3330. assign F_op_rdprs = F_iw_op == 56;
  3331. assign F_op_op_rsv57 = F_iw_op == 57;
  3332. assign F_op_flushd = F_iw_op == 59;
  3333. assign F_op_xorhi = F_iw_op == 60;
  3334. assign F_op_op_rsv61 = F_iw_op == 61;
  3335. assign F_op_op_rsv62 = F_iw_op == 62;
  3336. assign F_op_op_rsv63 = F_iw_op == 63;
  3337. assign F_op_opx_rsv00 = (F_iw_opx == 0) & F_is_opx_inst;
  3338. assign F_op_eret = (F_iw_opx == 1) & F_is_opx_inst;
  3339. assign F_op_roli = (F_iw_opx == 2) & F_is_opx_inst;
  3340. assign F_op_rol = (F_iw_opx == 3) & F_is_opx_inst;
  3341. assign F_op_flushp = (F_iw_opx == 4) & F_is_opx_inst;
  3342. assign F_op_ret = (F_iw_opx == 5) & F_is_opx_inst;
  3343. assign F_op_nor = (F_iw_opx == 6) & F_is_opx_inst;
  3344. assign F_op_mulxuu = (F_iw_opx == 7) & F_is_opx_inst;
  3345. assign F_op_cmpge = (F_iw_opx == 8) & F_is_opx_inst;
  3346. assign F_op_bret = (F_iw_opx == 9) & F_is_opx_inst;
  3347. assign F_op_opx_rsv10 = (F_iw_opx == 10) & F_is_opx_inst;
  3348. assign F_op_ror = (F_iw_opx == 11) & F_is_opx_inst;
  3349. assign F_op_flushi = (F_iw_opx == 12) & F_is_opx_inst;
  3350. assign F_op_jmp = (F_iw_opx == 13) & F_is_opx_inst;
  3351. assign F_op_and = (F_iw_opx == 14) & F_is_opx_inst;
  3352. assign F_op_opx_rsv15 = (F_iw_opx == 15) & F_is_opx_inst;
  3353. assign F_op_cmplt = (F_iw_opx == 16) & F_is_opx_inst;
  3354. assign F_op_opx_rsv17 = (F_iw_opx == 17) & F_is_opx_inst;
  3355. assign F_op_slli = (F_iw_opx == 18) & F_is_opx_inst;
  3356. assign F_op_sll = (F_iw_opx == 19) & F_is_opx_inst;
  3357. assign F_op_wrprs = (F_iw_opx == 20) & F_is_opx_inst;
  3358. assign F_op_opx_rsv21 = (F_iw_opx == 21) & F_is_opx_inst;
  3359. assign F_op_or = (F_iw_opx == 22) & F_is_opx_inst;
  3360. assign F_op_mulxsu = (F_iw_opx == 23) & F_is_opx_inst;
  3361. assign F_op_cmpne = (F_iw_opx == 24) & F_is_opx_inst;
  3362. assign F_op_opx_rsv25 = (F_iw_opx == 25) & F_is_opx_inst;
  3363. assign F_op_srli = (F_iw_opx == 26) & F_is_opx_inst;
  3364. assign F_op_srl = (F_iw_opx == 27) & F_is_opx_inst;
  3365. assign F_op_nextpc = (F_iw_opx == 28) & F_is_opx_inst;
  3366. assign F_op_callr = (F_iw_opx == 29) & F_is_opx_inst;
  3367. assign F_op_xor = (F_iw_opx == 30) & F_is_opx_inst;
  3368. assign F_op_mulxss = (F_iw_opx == 31) & F_is_opx_inst;
  3369. assign F_op_cmpeq = (F_iw_opx == 32) & F_is_opx_inst;
  3370. assign F_op_opx_rsv33 = (F_iw_opx == 33) & F_is_opx_inst;
  3371. assign F_op_opx_rsv34 = (F_iw_opx == 34) & F_is_opx_inst;
  3372. assign F_op_opx_rsv35 = (F_iw_opx == 35) & F_is_opx_inst;
  3373. assign F_op_divu = (F_iw_opx == 36) & F_is_opx_inst;
  3374. assign F_op_div = (F_iw_opx == 37) & F_is_opx_inst;
  3375. assign F_op_rdctl = (F_iw_opx == 38) & F_is_opx_inst;
  3376. assign F_op_mul = (F_iw_opx == 39) & F_is_opx_inst;
  3377. assign F_op_cmpgeu = (F_iw_opx == 40) & F_is_opx_inst;
  3378. assign F_op_initi = (F_iw_opx == 41) & F_is_opx_inst;
  3379. assign F_op_opx_rsv42 = (F_iw_opx == 42) & F_is_opx_inst;
  3380. assign F_op_opx_rsv43 = (F_iw_opx == 43) & F_is_opx_inst;
  3381. assign F_op_opx_rsv44 = (F_iw_opx == 44) & F_is_opx_inst;
  3382. assign F_op_trap = (F_iw_opx == 45) & F_is_opx_inst;
  3383. assign F_op_wrctl = (F_iw_opx == 46) & F_is_opx_inst;
  3384. assign F_op_opx_rsv47 = (F_iw_opx == 47) & F_is_opx_inst;
  3385. assign F_op_cmpltu = (F_iw_opx == 48) & F_is_opx_inst;
  3386. assign F_op_add = (F_iw_opx == 49) & F_is_opx_inst;
  3387. assign F_op_opx_rsv50 = (F_iw_opx == 50) & F_is_opx_inst;
  3388. assign F_op_opx_rsv51 = (F_iw_opx == 51) & F_is_opx_inst;
  3389. assign F_op_break = (F_iw_opx == 52) & F_is_opx_inst;
  3390. assign F_op_hbreak = (F_iw_opx == 53) & F_is_opx_inst;
  3391. assign F_op_sync = (F_iw_opx == 54) & F_is_opx_inst;
  3392. assign F_op_opx_rsv55 = (F_iw_opx == 55) & F_is_opx_inst;
  3393. assign F_op_opx_rsv56 = (F_iw_opx == 56) & F_is_opx_inst;
  3394. assign F_op_sub = (F_iw_opx == 57) & F_is_opx_inst;
  3395. assign F_op_srai = (F_iw_opx == 58) & F_is_opx_inst;
  3396. assign F_op_sra = (F_iw_opx == 59) & F_is_opx_inst;
  3397. assign F_op_opx_rsv60 = (F_iw_opx == 60) & F_is_opx_inst;
  3398. assign F_op_intr = (F_iw_opx == 61) & F_is_opx_inst;
  3399. assign F_op_crst = (F_iw_opx == 62) & F_is_opx_inst;
  3400. assign F_op_opx_rsv63 = (F_iw_opx == 63) & F_is_opx_inst;
  3401. assign F_op_nios_custom_instr_floating_point_0 = F_op_custom & 1'b1;
  3402. assign F_is_opx_inst = F_iw_op == 58;
  3403. assign D_op_call = D_iw_op == 0;
  3404. assign D_op_jmpi = D_iw_op == 1;
  3405. assign D_op_op_rsv02 = D_iw_op == 2;
  3406. assign D_op_ldbu = D_iw_op == 3;
  3407. assign D_op_addi = D_iw_op == 4;
  3408. assign D_op_stb = D_iw_op == 5;
  3409. assign D_op_br = D_iw_op == 6;
  3410. assign D_op_ldb = D_iw_op == 7;
  3411. assign D_op_cmpgei = D_iw_op == 8;
  3412. assign D_op_op_rsv09 = D_iw_op == 9;
  3413. assign D_op_op_rsv10 = D_iw_op == 10;
  3414. assign D_op_ldhu = D_iw_op == 11;
  3415. assign D_op_andi = D_iw_op == 12;
  3416. assign D_op_sth = D_iw_op == 13;
  3417. assign D_op_bge = D_iw_op == 14;
  3418. assign D_op_ldh = D_iw_op == 15;
  3419. assign D_op_cmplti = D_iw_op == 16;
  3420. assign D_op_op_rsv17 = D_iw_op == 17;
  3421. assign D_op_op_rsv18 = D_iw_op == 18;
  3422. assign D_op_initda = D_iw_op == 19;
  3423. assign D_op_ori = D_iw_op == 20;
  3424. assign D_op_stw = D_iw_op == 21;
  3425. assign D_op_blt = D_iw_op == 22;
  3426. assign D_op_ldw = D_iw_op == 23;
  3427. assign D_op_cmpnei = D_iw_op == 24;
  3428. assign D_op_op_rsv25 = D_iw_op == 25;
  3429. assign D_op_op_rsv26 = D_iw_op == 26;
  3430. assign D_op_flushda = D_iw_op == 27;
  3431. assign D_op_xori = D_iw_op == 28;
  3432. assign D_op_stc = D_iw_op == 29;
  3433. assign D_op_bne = D_iw_op == 30;
  3434. assign D_op_ldl = D_iw_op == 31;
  3435. assign D_op_cmpeqi = D_iw_op == 32;
  3436. assign D_op_op_rsv33 = D_iw_op == 33;
  3437. assign D_op_op_rsv34 = D_iw_op == 34;
  3438. assign D_op_ldbuio = D_iw_op == 35;
  3439. assign D_op_muli = D_iw_op == 36;
  3440. assign D_op_stbio = D_iw_op == 37;
  3441. assign D_op_beq = D_iw_op == 38;
  3442. assign D_op_ldbio = D_iw_op == 39;
  3443. assign D_op_cmpgeui = D_iw_op == 40;
  3444. assign D_op_op_rsv41 = D_iw_op == 41;
  3445. assign D_op_op_rsv42 = D_iw_op == 42;
  3446. assign D_op_ldhuio = D_iw_op == 43;
  3447. assign D_op_andhi = D_iw_op == 44;
  3448. assign D_op_sthio = D_iw_op == 45;
  3449. assign D_op_bgeu = D_iw_op == 46;
  3450. assign D_op_ldhio = D_iw_op == 47;
  3451. assign D_op_cmpltui = D_iw_op == 48;
  3452. assign D_op_op_rsv49 = D_iw_op == 49;
  3453. assign D_op_custom = D_iw_op == 50;
  3454. assign D_op_initd = D_iw_op == 51;
  3455. assign D_op_orhi = D_iw_op == 52;
  3456. assign D_op_stwio = D_iw_op == 53;
  3457. assign D_op_bltu = D_iw_op == 54;
  3458. assign D_op_ldwio = D_iw_op == 55;
  3459. assign D_op_rdprs = D_iw_op == 56;
  3460. assign D_op_op_rsv57 = D_iw_op == 57;
  3461. assign D_op_flushd = D_iw_op == 59;
  3462. assign D_op_xorhi = D_iw_op == 60;
  3463. assign D_op_op_rsv61 = D_iw_op == 61;
  3464. assign D_op_op_rsv62 = D_iw_op == 62;
  3465. assign D_op_op_rsv63 = D_iw_op == 63;
  3466. assign D_op_opx_rsv00 = (D_iw_opx == 0) & D_is_opx_inst;
  3467. assign D_op_eret = (D_iw_opx == 1) & D_is_opx_inst;
  3468. assign D_op_roli = (D_iw_opx == 2) & D_is_opx_inst;
  3469. assign D_op_rol = (D_iw_opx == 3) & D_is_opx_inst;
  3470. assign D_op_flushp = (D_iw_opx == 4) & D_is_opx_inst;
  3471. assign D_op_ret = (D_iw_opx == 5) & D_is_opx_inst;
  3472. assign D_op_nor = (D_iw_opx == 6) & D_is_opx_inst;
  3473. assign D_op_mulxuu = (D_iw_opx == 7) & D_is_opx_inst;
  3474. assign D_op_cmpge = (D_iw_opx == 8) & D_is_opx_inst;
  3475. assign D_op_bret = (D_iw_opx == 9) & D_is_opx_inst;
  3476. assign D_op_opx_rsv10 = (D_iw_opx == 10) & D_is_opx_inst;
  3477. assign D_op_ror = (D_iw_opx == 11) & D_is_opx_inst;
  3478. assign D_op_flushi = (D_iw_opx == 12) & D_is_opx_inst;
  3479. assign D_op_jmp = (D_iw_opx == 13) & D_is_opx_inst;
  3480. assign D_op_and = (D_iw_opx == 14) & D_is_opx_inst;
  3481. assign D_op_opx_rsv15 = (D_iw_opx == 15) & D_is_opx_inst;
  3482. assign D_op_cmplt = (D_iw_opx == 16) & D_is_opx_inst;
  3483. assign D_op_opx_rsv17 = (D_iw_opx == 17) & D_is_opx_inst;
  3484. assign D_op_slli = (D_iw_opx == 18) & D_is_opx_inst;
  3485. assign D_op_sll = (D_iw_opx == 19) & D_is_opx_inst;
  3486. assign D_op_wrprs = (D_iw_opx == 20) & D_is_opx_inst;
  3487. assign D_op_opx_rsv21 = (D_iw_opx == 21) & D_is_opx_inst;
  3488. assign D_op_or = (D_iw_opx == 22) & D_is_opx_inst;
  3489. assign D_op_mulxsu = (D_iw_opx == 23) & D_is_opx_inst;
  3490. assign D_op_cmpne = (D_iw_opx == 24) & D_is_opx_inst;
  3491. assign D_op_opx_rsv25 = (D_iw_opx == 25) & D_is_opx_inst;
  3492. assign D_op_srli = (D_iw_opx == 26) & D_is_opx_inst;
  3493. assign D_op_srl = (D_iw_opx == 27) & D_is_opx_inst;
  3494. assign D_op_nextpc = (D_iw_opx == 28) & D_is_opx_inst;
  3495. assign D_op_callr = (D_iw_opx == 29) & D_is_opx_inst;
  3496. assign D_op_xor = (D_iw_opx == 30) & D_is_opx_inst;
  3497. assign D_op_mulxss = (D_iw_opx == 31) & D_is_opx_inst;
  3498. assign D_op_cmpeq = (D_iw_opx == 32) & D_is_opx_inst;
  3499. assign D_op_opx_rsv33 = (D_iw_opx == 33) & D_is_opx_inst;
  3500. assign D_op_opx_rsv34 = (D_iw_opx == 34) & D_is_opx_inst;
  3501. assign D_op_opx_rsv35 = (D_iw_opx == 35) & D_is_opx_inst;
  3502. assign D_op_divu = (D_iw_opx == 36) & D_is_opx_inst;
  3503. assign D_op_div = (D_iw_opx == 37) & D_is_opx_inst;
  3504. assign D_op_rdctl = (D_iw_opx == 38) & D_is_opx_inst;
  3505. assign D_op_mul = (D_iw_opx == 39) & D_is_opx_inst;
  3506. assign D_op_cmpgeu = (D_iw_opx == 40) & D_is_opx_inst;
  3507. assign D_op_initi = (D_iw_opx == 41) & D_is_opx_inst;
  3508. assign D_op_opx_rsv42 = (D_iw_opx == 42) & D_is_opx_inst;
  3509. assign D_op_opx_rsv43 = (D_iw_opx == 43) & D_is_opx_inst;
  3510. assign D_op_opx_rsv44 = (D_iw_opx == 44) & D_is_opx_inst;
  3511. assign D_op_trap = (D_iw_opx == 45) & D_is_opx_inst;
  3512. assign D_op_wrctl = (D_iw_opx == 46) & D_is_opx_inst;
  3513. assign D_op_opx_rsv47 = (D_iw_opx == 47) & D_is_opx_inst;
  3514. assign D_op_cmpltu = (D_iw_opx == 48) & D_is_opx_inst;
  3515. assign D_op_add = (D_iw_opx == 49) & D_is_opx_inst;
  3516. assign D_op_opx_rsv50 = (D_iw_opx == 50) & D_is_opx_inst;
  3517. assign D_op_opx_rsv51 = (D_iw_opx == 51) & D_is_opx_inst;
  3518. assign D_op_break = (D_iw_opx == 52) & D_is_opx_inst;
  3519. assign D_op_hbreak = (D_iw_opx == 53) & D_is_opx_inst;
  3520. assign D_op_sync = (D_iw_opx == 54) & D_is_opx_inst;
  3521. assign D_op_opx_rsv55 = (D_iw_opx == 55) & D_is_opx_inst;
  3522. assign D_op_opx_rsv56 = (D_iw_opx == 56) & D_is_opx_inst;
  3523. assign D_op_sub = (D_iw_opx == 57) & D_is_opx_inst;
  3524. assign D_op_srai = (D_iw_opx == 58) & D_is_opx_inst;
  3525. assign D_op_sra = (D_iw_opx == 59) & D_is_opx_inst;
  3526. assign D_op_opx_rsv60 = (D_iw_opx == 60) & D_is_opx_inst;
  3527. assign D_op_intr = (D_iw_opx == 61) & D_is_opx_inst;
  3528. assign D_op_crst = (D_iw_opx == 62) & D_is_opx_inst;
  3529. assign D_op_opx_rsv63 = (D_iw_opx == 63) & D_is_opx_inst;
  3530. assign D_op_nios_custom_instr_floating_point_0 = D_op_custom & 1'b1;
  3531. assign D_is_opx_inst = D_iw_op == 58;
  3532. assign R_en = 1'b1;
  3533. assign E_ci_dataa = E_src1;
  3534. assign E_ci_datab = E_src2;
  3535. assign W_ci_ipending = W_ipending_reg;
  3536. assign W_ci_status = W_status_reg;
  3537. assign W_ci_estatus = W_estatus_reg;
  3538. assign D_ci_n = D_iw_custom_n;
  3539. assign D_ci_a = D_iw_a;
  3540. assign D_ci_b = D_iw_b;
  3541. assign D_ci_c = D_iw_c;
  3542. assign D_ci_readra = D_iw_custom_readra;
  3543. assign D_ci_readrb = D_iw_custom_readrb;
  3544. assign D_ci_writerc = D_iw_custom_writerc;
  3545. assign E_ci_multi_clock = clk;
  3546. assign E_ci_multi_reset = ~reset_n;
  3547. assign E_ci_multi_reset_req = reset_req;
  3548. //custom_instruction_master, which is an e_custom_instruction_master
  3549. assign iactive = irq[31 : 0] & 32'b00000000000000000000000000000001;
  3550. assign F_pc_sel_nxt = (R_ctrl_exception | W_rf_ecc_unrecoverable_valid) ? 2'b00 :
  3551. R_ctrl_break ? 2'b01 :
  3552. (W_br_taken | R_ctrl_uncond_cti_non_br) ? 2'b10 :
  3553. 2'b11;
  3554. assign F_pc_no_crst_nxt = (F_pc_sel_nxt == 2'b00)? 65544 :
  3555. (F_pc_sel_nxt == 2'b01)? 131592 :
  3556. (F_pc_sel_nxt == 2'b10)? E_arith_result[19 : 2] :
  3557. F_pc_plus_one;
  3558. assign F_pc_nxt = F_pc_no_crst_nxt;
  3559. assign F_pcb_nxt = {F_pc_nxt, 2'b00};
  3560. assign F_pc_en = W_valid | W_rf_ecc_unrecoverable_valid;
  3561. assign F_pc_plus_one = F_pc + 1;
  3562. always @(posedge clk or negedge reset_n)
  3563. begin
  3564. if (reset_n == 0)
  3565. F_pc <= 65536;
  3566. else if (F_pc_en)
  3567. F_pc <= F_pc_nxt;
  3568. end
  3569. assign F_pcb = {F_pc, 2'b00};
  3570. assign F_pcb_plus_four = {F_pc_plus_one, 2'b00};
  3571. assign F_valid = i_read & ~i_waitrequest;
  3572. assign i_read_nxt = W_valid | W_rf_ecc_unrecoverable_valid | (i_read & i_waitrequest);
  3573. assign i_address = {F_pc, 2'b00};
  3574. always @(posedge clk or negedge reset_n)
  3575. begin
  3576. if (reset_n == 0)
  3577. i_read <= 1'b1;
  3578. else
  3579. i_read <= i_read_nxt;
  3580. end
  3581. assign oci_tb_hbreak_req = oci_hbreak_req;
  3582. assign hbreak_req = (oci_tb_hbreak_req | hbreak_pending) & hbreak_enabled & ~(wait_for_one_post_bret_inst & ~W_valid);
  3583. assign hbreak_pending_nxt = hbreak_pending ? hbreak_enabled
  3584. : hbreak_req;
  3585. always @(posedge clk or negedge reset_n)
  3586. begin
  3587. if (reset_n == 0)
  3588. wait_for_one_post_bret_inst <= 1'b0;
  3589. else
  3590. wait_for_one_post_bret_inst <= (~hbreak_enabled & oci_single_step_mode) ? 1'b1 : (F_valid | ~oci_single_step_mode) ? 1'b0 : wait_for_one_post_bret_inst;
  3591. end
  3592. always @(posedge clk or negedge reset_n)
  3593. begin
  3594. if (reset_n == 0)
  3595. hbreak_pending <= 1'b0;
  3596. else
  3597. hbreak_pending <= hbreak_pending_nxt;
  3598. end
  3599. assign intr_req = W_status_reg_pie & (W_ipending_reg != 0);
  3600. assign F_av_iw = i_readdata;
  3601. assign F_iw = hbreak_req ? 4040762 :
  3602. 1'b0 ? 127034 :
  3603. intr_req ? 3926074 :
  3604. F_av_iw;
  3605. always @(posedge clk or negedge reset_n)
  3606. begin
  3607. if (reset_n == 0)
  3608. D_iw <= 0;
  3609. else if (F_valid)
  3610. D_iw <= F_iw;
  3611. end
  3612. always @(posedge clk or negedge reset_n)
  3613. begin
  3614. if (reset_n == 0)
  3615. D_valid <= 0;
  3616. else
  3617. D_valid <= F_valid | W1_rf_ecc_recoverable_valid;
  3618. end
  3619. assign D_dst_regnum = D_ctrl_implicit_dst_retaddr ? 5'd31 :
  3620. D_ctrl_implicit_dst_eretaddr ? 5'd29 :
  3621. D_ctrl_b_is_dst ? D_iw_b :
  3622. D_iw_c;
  3623. assign D_wr_dst_reg = (D_dst_regnum != 0) & ~D_ctrl_ignore_dst;
  3624. assign D_logic_op_raw = D_is_opx_inst ? D_iw_opx[4 : 3] :
  3625. D_iw_op[4 : 3];
  3626. assign D_logic_op = D_ctrl_alu_force_xor ? 2'b11 :
  3627. D_ctrl_alu_force_and ? 2'b01 :
  3628. D_logic_op_raw;
  3629. assign D_compare_op = D_is_opx_inst ? D_iw_opx[4 : 3] :
  3630. D_iw_op[4 : 3];
  3631. assign D_jmp_direct_target_waddr = D_iw[31 : 6];
  3632. always @(posedge clk or negedge reset_n)
  3633. begin
  3634. if (reset_n == 0)
  3635. R_valid <= 0;
  3636. else
  3637. R_valid <= D_valid;
  3638. end
  3639. always @(posedge clk or negedge reset_n)
  3640. begin
  3641. if (reset_n == 0)
  3642. R_wr_dst_reg <= 0;
  3643. else
  3644. R_wr_dst_reg <= D_wr_dst_reg;
  3645. end
  3646. always @(posedge clk or negedge reset_n)
  3647. begin
  3648. if (reset_n == 0)
  3649. R_dst_regnum <= 0;
  3650. else
  3651. R_dst_regnum <= D_dst_regnum;
  3652. end
  3653. always @(posedge clk or negedge reset_n)
  3654. begin
  3655. if (reset_n == 0)
  3656. R_logic_op <= 0;
  3657. else
  3658. R_logic_op <= D_logic_op;
  3659. end
  3660. always @(posedge clk or negedge reset_n)
  3661. begin
  3662. if (reset_n == 0)
  3663. R_compare_op <= 0;
  3664. else
  3665. R_compare_op <= D_compare_op;
  3666. end
  3667. always @(posedge clk or negedge reset_n)
  3668. begin
  3669. if (reset_n == 0)
  3670. R_src2_use_imm <= 0;
  3671. else
  3672. R_src2_use_imm <= D_ctrl_src2_choose_imm | (D_ctrl_br & R_valid);
  3673. end
  3674. assign E_rf_ecc_valid_any = E_rf_ecc_recoverable_valid|E_rf_ecc_unrecoverable_valid;
  3675. assign W_rf_ecc_valid_any = W_rf_ecc_recoverable_valid|W_rf_ecc_unrecoverable_valid;
  3676. assign E_rf_ecc_recoverable_valid = 1'b0;
  3677. assign E_rf_ecc_unrecoverable_valid = 1'b0;
  3678. assign W_dst_regnum = R_dst_regnum;
  3679. always @(posedge clk or negedge reset_n)
  3680. begin
  3681. if (reset_n == 0)
  3682. W_rf_ecc_recoverable_valid <= 0;
  3683. else
  3684. W_rf_ecc_recoverable_valid <= E_rf_ecc_recoverable_valid;
  3685. end
  3686. always @(posedge clk or negedge reset_n)
  3687. begin
  3688. if (reset_n == 0)
  3689. W1_rf_ecc_recoverable_valid <= 0;
  3690. else
  3691. W1_rf_ecc_recoverable_valid <= W_rf_ecc_recoverable_valid;
  3692. end
  3693. always @(posedge clk or negedge reset_n)
  3694. begin
  3695. if (reset_n == 0)
  3696. W_rf_ecc_unrecoverable_valid <= 0;
  3697. else
  3698. W_rf_ecc_unrecoverable_valid <= E_rf_ecc_unrecoverable_valid & ~E_rf_ecc_recoverable_valid;
  3699. end
  3700. assign R_rf_a = R_rf_a_q;
  3701. assign R_rf_b = R_rf_b_q;
  3702. assign W_rf_wren = (R_wr_dst_reg & W_valid) | W_rf_ecc_valid_any | ~reset_n;
  3703. assign W_rf_wr_data = R_ctrl_ld ? av_ld_data_aligned_filtered : W_wr_data;
  3704. //nios2_uc_nios2_cpu_register_bank_a, which is an nios_sdp_ram
  3705. nios2_uc_nios2_cpu_register_bank_a_module nios2_uc_nios2_cpu_register_bank_a
  3706. (
  3707. .clock (clk),
  3708. .data (W_rf_wr_data),
  3709. .q (R_rf_a_q),
  3710. .rdaddress (D_iw_a),
  3711. .wraddress (W_dst_regnum),
  3712. .wren (W_rf_wren)
  3713. );
  3714. //synthesis translate_off
  3715. `ifdef NO_PLI
  3716. defparam nios2_uc_nios2_cpu_register_bank_a.lpm_file = "nios2_uc_nios2_cpu_rf_ram_a.dat";
  3717. `else
  3718. defparam nios2_uc_nios2_cpu_register_bank_a.lpm_file = "nios2_uc_nios2_cpu_rf_ram_a.hex";
  3719. `endif
  3720. //synthesis translate_on
  3721. //nios2_uc_nios2_cpu_register_bank_b, which is an nios_sdp_ram
  3722. nios2_uc_nios2_cpu_register_bank_b_module nios2_uc_nios2_cpu_register_bank_b
  3723. (
  3724. .clock (clk),
  3725. .data (W_rf_wr_data),
  3726. .q (R_rf_b_q),
  3727. .rdaddress (D_iw_b),
  3728. .wraddress (W_dst_regnum),
  3729. .wren (W_rf_wren)
  3730. );
  3731. //synthesis translate_off
  3732. `ifdef NO_PLI
  3733. defparam nios2_uc_nios2_cpu_register_bank_b.lpm_file = "nios2_uc_nios2_cpu_rf_ram_b.dat";
  3734. `else
  3735. defparam nios2_uc_nios2_cpu_register_bank_b.lpm_file = "nios2_uc_nios2_cpu_rf_ram_b.hex";
  3736. `endif
  3737. //synthesis translate_on
  3738. assign R_src1 = (((R_ctrl_br & E_valid_from_R) | (R_ctrl_retaddr & R_valid)))? {F_pc_plus_one, 2'b00} :
  3739. ((R_ctrl_jmp_direct & E_valid_from_R))? {D_jmp_direct_target_waddr, 2'b00} :
  3740. R_rf_a;
  3741. assign R_src2_lo = ((R_ctrl_force_src2_zero|R_ctrl_hi_imm16))? {16 {D_ctrl_set_src2_rem_imm}} :
  3742. (R_ctrl_src_imm5_shift_rot)? {{11 {1'b0}},D_iw_imm5} :
  3743. (R_src2_use_imm)? D_iw_imm16 :
  3744. R_rf_b[15 : 0];
  3745. assign R_src2_hi = ((R_ctrl_force_src2_zero|R_ctrl_unsigned_lo_imm16))? {16 {D_ctrl_set_src2_rem_imm}} :
  3746. (R_ctrl_hi_imm16)? D_iw_imm16 :
  3747. (R_src2_use_imm)? {16 {D_iw_imm16[15]}} :
  3748. R_rf_b[31 : 16];
  3749. assign R_src2 = {R_src2_hi, R_src2_lo};
  3750. always @(posedge clk or negedge reset_n)
  3751. begin
  3752. if (reset_n == 0)
  3753. E_valid_from_R <= 0;
  3754. else
  3755. E_valid_from_R <= R_valid | E_stall;
  3756. end
  3757. always @(posedge clk or negedge reset_n)
  3758. begin
  3759. if (reset_n == 0)
  3760. E_new_inst <= 0;
  3761. else
  3762. E_new_inst <= R_valid;
  3763. end
  3764. always @(posedge clk or negedge reset_n)
  3765. begin
  3766. if (reset_n == 0)
  3767. E_src1 <= 0;
  3768. else
  3769. E_src1 <= R_src1;
  3770. end
  3771. always @(posedge clk or negedge reset_n)
  3772. begin
  3773. if (reset_n == 0)
  3774. E_src2 <= 0;
  3775. else
  3776. E_src2 <= R_src2;
  3777. end
  3778. always @(posedge clk or negedge reset_n)
  3779. begin
  3780. if (reset_n == 0)
  3781. E_invert_arith_src_msb <= 0;
  3782. else
  3783. E_invert_arith_src_msb <= D_ctrl_alu_signed_comparison & R_valid;
  3784. end
  3785. always @(posedge clk or negedge reset_n)
  3786. begin
  3787. if (reset_n == 0)
  3788. E_alu_sub <= 0;
  3789. else
  3790. E_alu_sub <= D_ctrl_alu_subtract & R_valid;
  3791. end
  3792. assign E_valid = E_valid_from_R & ~E_rf_ecc_valid_any;
  3793. assign E_stall = (E_shift_rot_stall | E_ld_stall | E_st_stall | E_ci_multi_stall) & ~(E_rf_ecc_valid_any|W_rf_ecc_valid_any|W1_rf_ecc_recoverable_valid);
  3794. always @(posedge clk or negedge reset_n)
  3795. begin
  3796. if (reset_n == 0)
  3797. E_ci_multi_start <= 0;
  3798. else
  3799. E_ci_multi_start <= E_ci_multi_start ? 1'b0 :
  3800. (R_ctrl_custom_multi & R_valid);
  3801. end
  3802. always @(posedge clk or negedge reset_n)
  3803. begin
  3804. if (reset_n == 0)
  3805. E_ci_multi_clk_en <= 0;
  3806. else
  3807. E_ci_multi_clk_en <= E_ci_multi_clk_en ? ~E_ci_multi_done :
  3808. (R_ctrl_custom_multi & R_valid);
  3809. end
  3810. assign E_ci_multi_stall = R_ctrl_custom_multi & E_valid & ~E_ci_multi_done;
  3811. assign E_arith_src1 = { E_src1[31] ^ E_invert_arith_src_msb,
  3812. E_src1[30 : 0]};
  3813. assign E_arith_src2 = { E_src2[31] ^ E_invert_arith_src_msb,
  3814. E_src2[30 : 0]};
  3815. assign E_arith_result = E_alu_sub ?
  3816. E_arith_src1 - E_arith_src2 :
  3817. E_arith_src1 + E_arith_src2;
  3818. assign E_mem_baddr = E_arith_result[19 : 0];
  3819. assign E_logic_result = (R_logic_op == 2'b00)? (~(E_src1 | E_src2)) :
  3820. (R_logic_op == 2'b01)? (E_src1 & E_src2) :
  3821. (R_logic_op == 2'b10)? (E_src1 | E_src2) :
  3822. (E_src1 ^ E_src2);
  3823. assign E_logic_result_is_0 = E_logic_result == 0;
  3824. assign E_eq = E_logic_result_is_0;
  3825. assign E_lt = E_arith_result[32];
  3826. assign E_cmp_result = (R_compare_op == 2'b00)? E_eq :
  3827. (R_compare_op == 2'b01)? ~E_lt :
  3828. (R_compare_op == 2'b10)? E_lt :
  3829. ~E_eq;
  3830. assign E_shift_rot_shfcnt = E_src2[4 : 0];
  3831. assign E_shift_rot_cnt_nxt = E_new_inst ? E_shift_rot_shfcnt : E_shift_rot_cnt-1;
  3832. assign E_shift_rot_done = (E_shift_rot_cnt == 0) & ~E_new_inst;
  3833. assign E_shift_rot_stall = R_ctrl_shift_rot & E_valid & ~E_shift_rot_done;
  3834. assign E_shift_rot_fill_bit = R_ctrl_shift_logical ? 1'b0 :
  3835. (R_ctrl_rot_right ? E_shift_rot_result[0] :
  3836. E_shift_rot_result[31]);
  3837. assign E_shift_rot_result_nxt = (E_new_inst)? E_src1 :
  3838. (R_ctrl_shift_rot_right)? {E_shift_rot_fill_bit, E_shift_rot_result[31 : 1]} :
  3839. {E_shift_rot_result[30 : 0], E_shift_rot_fill_bit};
  3840. always @(posedge clk or negedge reset_n)
  3841. begin
  3842. if (reset_n == 0)
  3843. E_shift_rot_result <= 0;
  3844. else
  3845. E_shift_rot_result <= E_shift_rot_result_nxt;
  3846. end
  3847. always @(posedge clk or negedge reset_n)
  3848. begin
  3849. if (reset_n == 0)
  3850. E_shift_rot_cnt <= 0;
  3851. else
  3852. E_shift_rot_cnt <= E_shift_rot_cnt_nxt;
  3853. end
  3854. assign E_control_rd_data = (D_iw_control_regnum == 5'd0)? W_status_reg :
  3855. (D_iw_control_regnum == 5'd1)? W_estatus_reg :
  3856. (D_iw_control_regnum == 5'd2)? W_bstatus_reg :
  3857. (D_iw_control_regnum == 5'd3)? W_ienable_reg :
  3858. (D_iw_control_regnum == 5'd4)? W_ipending_reg :
  3859. (D_iw_control_regnum == 5'd5)? W_cpuid_reg :
  3860. W_cdsr_reg;
  3861. assign E_alu_result = ((R_ctrl_br_cmp | R_ctrl_rd_ctl_reg))? 0 :
  3862. (R_ctrl_shift_rot)? E_shift_rot_result :
  3863. (R_ctrl_logic)? E_logic_result :
  3864. (R_ctrl_custom)? E_ci_result :
  3865. E_arith_result;
  3866. assign R_sth_data = R_rf_b[15 : 0];
  3867. assign R_stw_data = R_rf_b[31 : 0];
  3868. assign R_stb_data = R_rf_b[7 : 0];
  3869. assign E_st_data = (D_ctrl_mem8)? {R_stb_data, R_stb_data, R_stb_data, R_stb_data} :
  3870. (D_ctrl_mem16)? {R_sth_data, R_sth_data} :
  3871. R_stw_data;
  3872. assign E_mem_byte_en = ({D_ctrl_mem16, D_ctrl_mem8, E_mem_baddr[1 : 0]} == {2'b01, 2'b00})? 4'b0001 :
  3873. ({D_ctrl_mem16, D_ctrl_mem8, E_mem_baddr[1 : 0]} == {2'b01, 2'b01})? 4'b0010 :
  3874. ({D_ctrl_mem16, D_ctrl_mem8, E_mem_baddr[1 : 0]} == {2'b01, 2'b10})? 4'b0100 :
  3875. ({D_ctrl_mem16, D_ctrl_mem8, E_mem_baddr[1 : 0]} == {2'b01, 2'b11})? 4'b1000 :
  3876. ({D_ctrl_mem16, D_ctrl_mem8, E_mem_baddr[1 : 0]} == {2'b10, 2'b00})? 4'b0011 :
  3877. ({D_ctrl_mem16, D_ctrl_mem8, E_mem_baddr[1 : 0]} == {2'b10, 2'b01})? 4'b0011 :
  3878. ({D_ctrl_mem16, D_ctrl_mem8, E_mem_baddr[1 : 0]} == {2'b10, 2'b10})? 4'b1100 :
  3879. ({D_ctrl_mem16, D_ctrl_mem8, E_mem_baddr[1 : 0]} == {2'b10, 2'b11})? 4'b1100 :
  3880. 4'b1111;
  3881. assign d_read_nxt = (R_ctrl_ld & E_new_inst & ~E_rf_ecc_valid_any) | (d_read & d_waitrequest);
  3882. assign E_ld_stall = R_ctrl_ld & ((E_valid & ~av_ld_done) | E_new_inst);
  3883. assign d_write_nxt = ((R_ctrl_st & (~R_ctrl_st_ex | W_up_ex_mon_state)) & E_new_inst & ~E_rf_ecc_valid_any) | (d_write & d_waitrequest);
  3884. assign E_st_stall = d_write_nxt;
  3885. assign d_address = W_mem_baddr;
  3886. assign av_ld_getting_data = d_read & ~d_waitrequest;
  3887. always @(posedge clk or negedge reset_n)
  3888. begin
  3889. if (reset_n == 0)
  3890. d_read <= 0;
  3891. else
  3892. d_read <= d_read_nxt;
  3893. end
  3894. always @(posedge clk or negedge reset_n)
  3895. begin
  3896. if (reset_n == 0)
  3897. d_writedata <= 0;
  3898. else
  3899. d_writedata <= E_st_data;
  3900. end
  3901. always @(posedge clk or negedge reset_n)
  3902. begin
  3903. if (reset_n == 0)
  3904. d_byteenable <= 0;
  3905. else
  3906. d_byteenable <= E_mem_byte_en;
  3907. end
  3908. assign av_ld_align_cycle_nxt = av_ld_getting_data ? 0 : (av_ld_align_cycle+1);
  3909. assign av_ld_align_one_more_cycle = av_ld_align_cycle == (D_ctrl_mem16 ? 2 : 3);
  3910. assign av_ld_aligning_data_nxt = av_ld_aligning_data ?
  3911. ~av_ld_align_one_more_cycle :
  3912. (~D_ctrl_mem32 & av_ld_getting_data);
  3913. assign av_ld_waiting_for_data_nxt = av_ld_waiting_for_data ?
  3914. ~av_ld_getting_data :
  3915. (R_ctrl_ld & E_new_inst);
  3916. assign av_ld_done = ~av_ld_waiting_for_data_nxt & (D_ctrl_mem32 | ~av_ld_aligning_data_nxt);
  3917. assign av_ld_rshift8 = av_ld_aligning_data &
  3918. (av_ld_align_cycle < (W_mem_baddr[1 : 0]));
  3919. assign av_ld_extend = av_ld_aligning_data;
  3920. assign av_ld_byte0_data_nxt = av_ld_rshift8 ? av_ld_byte1_data :
  3921. av_ld_extend ? av_ld_byte0_data :d_readdata[7 : 0];
  3922. assign av_ld_byte1_data_nxt = av_ld_rshift8 ? av_ld_byte2_data :
  3923. av_ld_extend ? {8 {av_fill_bit}} :d_readdata[15 : 8];
  3924. assign av_ld_byte2_data_nxt = av_ld_rshift8 ? av_ld_byte3_data :
  3925. av_ld_extend ? {8 {av_fill_bit}} :d_readdata[23 : 16];
  3926. assign av_ld_byte3_data_nxt = av_ld_rshift8 ? av_ld_byte3_data :
  3927. av_ld_extend ? {8 {av_fill_bit}} :d_readdata[31 : 24];
  3928. assign av_ld_byte1_data_en = ~(av_ld_extend & D_ctrl_mem16 & ~av_ld_rshift8);
  3929. assign av_ld_data_aligned_unfiltered = {av_ld_byte3_data, av_ld_byte2_data,
  3930. av_ld_byte1_data, av_ld_byte0_data};
  3931. assign av_sign_bit = D_ctrl_mem16 ? av_ld_byte1_data[7] : av_ld_byte0_data[7];
  3932. assign av_fill_bit = av_sign_bit & R_ctrl_ld_signed;
  3933. always @(posedge clk or negedge reset_n)
  3934. begin
  3935. if (reset_n == 0)
  3936. av_ld_align_cycle <= 0;
  3937. else
  3938. av_ld_align_cycle <= av_ld_align_cycle_nxt;
  3939. end
  3940. always @(posedge clk or negedge reset_n)
  3941. begin
  3942. if (reset_n == 0)
  3943. av_ld_waiting_for_data <= 0;
  3944. else
  3945. av_ld_waiting_for_data <= av_ld_waiting_for_data_nxt;
  3946. end
  3947. always @(posedge clk or negedge reset_n)
  3948. begin
  3949. if (reset_n == 0)
  3950. av_ld_aligning_data <= 0;
  3951. else
  3952. av_ld_aligning_data <= av_ld_aligning_data_nxt;
  3953. end
  3954. always @(posedge clk or negedge reset_n)
  3955. begin
  3956. if (reset_n == 0)
  3957. av_ld_byte0_data <= 0;
  3958. else
  3959. av_ld_byte0_data <= av_ld_byte0_data_nxt;
  3960. end
  3961. always @(posedge clk or negedge reset_n)
  3962. begin
  3963. if (reset_n == 0)
  3964. av_ld_byte1_data <= 0;
  3965. else if (av_ld_byte1_data_en)
  3966. av_ld_byte1_data <= av_ld_byte1_data_nxt;
  3967. end
  3968. always @(posedge clk or negedge reset_n)
  3969. begin
  3970. if (reset_n == 0)
  3971. av_ld_byte2_data <= 0;
  3972. else
  3973. av_ld_byte2_data <= av_ld_byte2_data_nxt;
  3974. end
  3975. always @(posedge clk or negedge reset_n)
  3976. begin
  3977. if (reset_n == 0)
  3978. av_ld_byte3_data <= 0;
  3979. else
  3980. av_ld_byte3_data <= av_ld_byte3_data_nxt;
  3981. end
  3982. always @(posedge clk or negedge reset_n)
  3983. begin
  3984. if (reset_n == 0)
  3985. W_up_ex_mon_state <= 0;
  3986. else if (R_en)
  3987. W_up_ex_mon_state <= (R_ctrl_ld_ex & W_valid) ? 1'b1 :
  3988. ((D_op_eret & W_valid) | (R_ctrl_st_ex & W_valid)) ? 1'b0 :
  3989. W_up_ex_mon_state;
  3990. end
  3991. assign W_valid_from_M = W_valid;
  3992. always @(posedge clk or negedge reset_n)
  3993. begin
  3994. if (reset_n == 0)
  3995. W_valid <= 0;
  3996. else
  3997. W_valid <= E_valid & ~E_stall;
  3998. end
  3999. always @(posedge clk or negedge reset_n)
  4000. begin
  4001. if (reset_n == 0)
  4002. A_valid_from_M <= 0;
  4003. else
  4004. A_valid_from_M <= E_valid & ~E_stall;
  4005. end
  4006. always @(posedge clk or negedge reset_n)
  4007. begin
  4008. if (reset_n == 0)
  4009. W_control_rd_data <= 0;
  4010. else
  4011. W_control_rd_data <= D_ctrl_intr_inst ? W_status_reg : E_control_rd_data;
  4012. end
  4013. always @(posedge clk or negedge reset_n)
  4014. begin
  4015. if (reset_n == 0)
  4016. W_cmp_result <= 0;
  4017. else
  4018. W_cmp_result <= E_cmp_result;
  4019. end
  4020. always @(posedge clk or negedge reset_n)
  4021. begin
  4022. if (reset_n == 0)
  4023. W_alu_result <= 0;
  4024. else
  4025. W_alu_result <= E_alu_result;
  4026. end
  4027. always @(posedge clk or negedge reset_n)
  4028. begin
  4029. if (reset_n == 0)
  4030. W_status_reg_pie <= 0;
  4031. else
  4032. W_status_reg_pie <= W_status_reg_pie_nxt;
  4033. end
  4034. always @(posedge clk or negedge reset_n)
  4035. begin
  4036. if (reset_n == 0)
  4037. W_estatus_reg <= 0;
  4038. else
  4039. W_estatus_reg <= W_estatus_reg_nxt;
  4040. end
  4041. always @(posedge clk or negedge reset_n)
  4042. begin
  4043. if (reset_n == 0)
  4044. W_bstatus_reg <= 0;
  4045. else
  4046. W_bstatus_reg <= W_bstatus_reg_nxt;
  4047. end
  4048. always @(posedge clk or negedge reset_n)
  4049. begin
  4050. if (reset_n == 0)
  4051. W_ienable_reg <= 0;
  4052. else
  4053. W_ienable_reg <= W_ienable_reg_nxt;
  4054. end
  4055. always @(posedge clk or negedge reset_n)
  4056. begin
  4057. if (reset_n == 0)
  4058. W_ipending_reg <= 0;
  4059. else
  4060. W_ipending_reg <= W_ipending_reg_nxt;
  4061. end
  4062. always @(posedge clk or negedge reset_n)
  4063. begin
  4064. if (reset_n == 0)
  4065. W_cdsr_reg <= 0;
  4066. else
  4067. W_cdsr_reg <= 0;
  4068. end
  4069. assign W_cpuid_reg = 0;
  4070. assign W_wr_data_non_zero = R_ctrl_br_cmp ? W_cmp_result :
  4071. R_ctrl_rd_ctl_reg ? W_control_rd_data :
  4072. W_alu_result[31 : 0];
  4073. assign W_wr_data = W_wr_data_non_zero;
  4074. assign W_br_taken = R_ctrl_br_uncond | (R_ctrl_br & W_cmp_result);
  4075. assign W_mem_baddr = W_alu_result[19 : 0];
  4076. assign W_status_reg = W_status_reg_pie;
  4077. assign E_wrctl_status = R_ctrl_wrctl_inst &
  4078. (D_iw_control_regnum == 5'd0);
  4079. assign E_wrctl_estatus = R_ctrl_wrctl_inst &
  4080. (D_iw_control_regnum == 5'd1);
  4081. assign E_wrctl_bstatus = R_ctrl_wrctl_inst &
  4082. (D_iw_control_regnum == 5'd2);
  4083. assign E_wrctl_ienable = R_ctrl_wrctl_inst &
  4084. (D_iw_control_regnum == 5'd3);
  4085. assign W_status_reg_pie_inst_nxt = (R_ctrl_exception | R_ctrl_break | R_ctrl_crst | W_rf_ecc_unrecoverable_valid) ? 1'b0 :
  4086. (D_op_eret) ? W_estatus_reg :
  4087. (D_op_bret) ? W_bstatus_reg :
  4088. (E_wrctl_status) ? E_src1[0] :
  4089. W_status_reg_pie;
  4090. assign W_status_reg_pie_nxt = E_valid ? W_status_reg_pie_inst_nxt : W_status_reg_pie;
  4091. assign W_estatus_reg_inst_nxt = (R_ctrl_crst) ? 0 :
  4092. (R_ctrl_exception|W_rf_ecc_unrecoverable_valid) ? W_status_reg :
  4093. (E_wrctl_estatus) ? E_src1[0] :
  4094. W_estatus_reg;
  4095. assign W_estatus_reg_nxt = E_valid ? W_estatus_reg_inst_nxt : W_estatus_reg;
  4096. assign W_bstatus_reg_inst_nxt = (R_ctrl_break) ? W_status_reg :
  4097. (E_wrctl_bstatus) ? E_src1[0] :
  4098. W_bstatus_reg;
  4099. assign W_bstatus_reg_nxt = E_valid ? W_bstatus_reg_inst_nxt : W_bstatus_reg;
  4100. assign W_ienable_reg_nxt = ((E_wrctl_ienable & E_valid) ?
  4101. E_src1[31 : 0] : W_ienable_reg) & 32'b00000000000000000000000000000001;
  4102. assign W_ipending_reg_nxt = iactive & W_ienable_reg & oci_ienable & 32'b00000000000000000000000000000001;
  4103. always @(posedge clk or negedge reset_n)
  4104. begin
  4105. if (reset_n == 0)
  4106. hbreak_enabled <= 1'b1;
  4107. else if (E_valid)
  4108. hbreak_enabled <= R_ctrl_break ? 1'b0 : D_op_bret ? 1'b1 : hbreak_enabled;
  4109. end
  4110. always @(posedge clk or negedge reset_n)
  4111. begin
  4112. if (reset_n == 0)
  4113. d_write <= 0;
  4114. else
  4115. d_write <= d_write_nxt;
  4116. end
  4117. nios2_uc_nios2_cpu_nios2_oci the_nios2_uc_nios2_cpu_nios2_oci
  4118. (
  4119. .D_valid (D_valid),
  4120. .E_st_data (E_st_data),
  4121. .E_valid (E_valid),
  4122. .F_pc (F_pc),
  4123. .address_nxt (debug_mem_slave_address),
  4124. .av_ld_data_aligned_filtered (av_ld_data_aligned_filtered),
  4125. .byteenable_nxt (debug_mem_slave_byteenable),
  4126. .clk (debug_mem_slave_clk),
  4127. .d_address (d_address),
  4128. .d_read (d_read),
  4129. .d_waitrequest (d_waitrequest),
  4130. .d_write (d_write),
  4131. .debug_mem_slave_debugaccess_to_roms (debug_mem_slave_debugaccess_to_roms),
  4132. .debugaccess_nxt (debug_mem_slave_debugaccess),
  4133. .hbreak_enabled (hbreak_enabled),
  4134. .oci_hbreak_req (oci_hbreak_req),
  4135. .oci_ienable (oci_ienable),
  4136. .oci_single_step_mode (oci_single_step_mode),
  4137. .read_nxt (debug_mem_slave_read),
  4138. .readdata (debug_mem_slave_readdata),
  4139. .reset (debug_mem_slave_reset),
  4140. .reset_n (reset_n),
  4141. .reset_req (reset_req),
  4142. .resetrequest (debug_reset_request),
  4143. .waitrequest (debug_mem_slave_waitrequest),
  4144. .write_nxt (debug_mem_slave_write),
  4145. .writedata_nxt (debug_mem_slave_writedata)
  4146. );
  4147. //debug_mem_slave, which is an e_avalon_slave
  4148. assign debug_mem_slave_clk = clk;
  4149. assign debug_mem_slave_reset = ~reset_n;
  4150. assign D_ctrl_custom = D_op_nios_custom_instr_floating_point_0;
  4151. assign R_ctrl_custom_nxt = D_ctrl_custom;
  4152. always @(posedge clk or negedge reset_n)
  4153. begin
  4154. if (reset_n == 0)
  4155. R_ctrl_custom <= 0;
  4156. else if (R_en)
  4157. R_ctrl_custom <= R_ctrl_custom_nxt;
  4158. end
  4159. assign D_ctrl_custom_multi = D_op_nios_custom_instr_floating_point_0;
  4160. assign R_ctrl_custom_multi_nxt = D_ctrl_custom_multi;
  4161. always @(posedge clk or negedge reset_n)
  4162. begin
  4163. if (reset_n == 0)
  4164. R_ctrl_custom_multi <= 0;
  4165. else if (R_en)
  4166. R_ctrl_custom_multi <= R_ctrl_custom_multi_nxt;
  4167. end
  4168. assign D_ctrl_jmp_indirect = D_op_eret|D_op_bret|D_op_ret|D_op_jmp|D_op_callr;
  4169. assign R_ctrl_jmp_indirect_nxt = D_ctrl_jmp_indirect;
  4170. always @(posedge clk or negedge reset_n)
  4171. begin
  4172. if (reset_n == 0)
  4173. R_ctrl_jmp_indirect <= 0;
  4174. else if (R_en)
  4175. R_ctrl_jmp_indirect <= R_ctrl_jmp_indirect_nxt;
  4176. end
  4177. assign D_ctrl_jmp_direct = D_op_call|D_op_jmpi;
  4178. assign R_ctrl_jmp_direct_nxt = D_ctrl_jmp_direct;
  4179. always @(posedge clk or negedge reset_n)
  4180. begin
  4181. if (reset_n == 0)
  4182. R_ctrl_jmp_direct <= 0;
  4183. else if (R_en)
  4184. R_ctrl_jmp_direct <= R_ctrl_jmp_direct_nxt;
  4185. end
  4186. assign D_ctrl_implicit_dst_retaddr = D_op_call;
  4187. assign R_ctrl_implicit_dst_retaddr_nxt = D_ctrl_implicit_dst_retaddr;
  4188. always @(posedge clk or negedge reset_n)
  4189. begin
  4190. if (reset_n == 0)
  4191. R_ctrl_implicit_dst_retaddr <= 0;
  4192. else if (R_en)
  4193. R_ctrl_implicit_dst_retaddr <= R_ctrl_implicit_dst_retaddr_nxt;
  4194. end
  4195. assign D_ctrl_implicit_dst_eretaddr = D_op_div|
  4196. D_op_divu|
  4197. D_op_mul|
  4198. D_op_muli|
  4199. D_op_mulxss|
  4200. D_op_mulxsu|
  4201. D_op_mulxuu|
  4202. D_op_crst|
  4203. D_op_ldl|
  4204. D_op_op_rsv02|
  4205. D_op_op_rsv09|
  4206. D_op_op_rsv10|
  4207. D_op_op_rsv17|
  4208. D_op_op_rsv18|
  4209. D_op_op_rsv25|
  4210. D_op_op_rsv26|
  4211. D_op_op_rsv33|
  4212. D_op_op_rsv34|
  4213. D_op_op_rsv41|
  4214. D_op_op_rsv42|
  4215. D_op_op_rsv49|
  4216. D_op_op_rsv57|
  4217. D_op_op_rsv61|
  4218. D_op_op_rsv62|
  4219. D_op_op_rsv63|
  4220. D_op_opx_rsv00|
  4221. D_op_opx_rsv10|
  4222. D_op_opx_rsv15|
  4223. D_op_opx_rsv17|
  4224. D_op_opx_rsv21|
  4225. D_op_opx_rsv25|
  4226. D_op_opx_rsv33|
  4227. D_op_opx_rsv34|
  4228. D_op_opx_rsv35|
  4229. D_op_opx_rsv42|
  4230. D_op_opx_rsv43|
  4231. D_op_opx_rsv44|
  4232. D_op_opx_rsv47|
  4233. D_op_opx_rsv50|
  4234. D_op_opx_rsv51|
  4235. D_op_opx_rsv55|
  4236. D_op_opx_rsv56|
  4237. D_op_opx_rsv60|
  4238. D_op_opx_rsv63|
  4239. D_op_rdprs|
  4240. D_op_stc|
  4241. D_op_wrprs;
  4242. assign R_ctrl_implicit_dst_eretaddr_nxt = D_ctrl_implicit_dst_eretaddr;
  4243. always @(posedge clk or negedge reset_n)
  4244. begin
  4245. if (reset_n == 0)
  4246. R_ctrl_implicit_dst_eretaddr <= 0;
  4247. else if (R_en)
  4248. R_ctrl_implicit_dst_eretaddr <= R_ctrl_implicit_dst_eretaddr_nxt;
  4249. end
  4250. assign D_ctrl_exception = D_op_trap|
  4251. D_op_opx_rsv44|
  4252. D_op_div|
  4253. D_op_divu|
  4254. D_op_mul|
  4255. D_op_muli|
  4256. D_op_mulxss|
  4257. D_op_mulxsu|
  4258. D_op_mulxuu|
  4259. D_op_crst|
  4260. D_op_ldl|
  4261. D_op_op_rsv02|
  4262. D_op_op_rsv09|
  4263. D_op_op_rsv10|
  4264. D_op_op_rsv17|
  4265. D_op_op_rsv18|
  4266. D_op_op_rsv25|
  4267. D_op_op_rsv26|
  4268. D_op_op_rsv33|
  4269. D_op_op_rsv34|
  4270. D_op_op_rsv41|
  4271. D_op_op_rsv42|
  4272. D_op_op_rsv49|
  4273. D_op_op_rsv57|
  4274. D_op_op_rsv61|
  4275. D_op_op_rsv62|
  4276. D_op_op_rsv63|
  4277. D_op_opx_rsv00|
  4278. D_op_opx_rsv10|
  4279. D_op_opx_rsv15|
  4280. D_op_opx_rsv17|
  4281. D_op_opx_rsv21|
  4282. D_op_opx_rsv25|
  4283. D_op_opx_rsv33|
  4284. D_op_opx_rsv34|
  4285. D_op_opx_rsv35|
  4286. D_op_opx_rsv42|
  4287. D_op_opx_rsv43|
  4288. D_op_opx_rsv47|
  4289. D_op_opx_rsv50|
  4290. D_op_opx_rsv51|
  4291. D_op_opx_rsv55|
  4292. D_op_opx_rsv56|
  4293. D_op_opx_rsv60|
  4294. D_op_opx_rsv63|
  4295. D_op_rdprs|
  4296. D_op_stc|
  4297. D_op_wrprs|
  4298. D_op_intr;
  4299. assign R_ctrl_exception_nxt = D_ctrl_exception;
  4300. always @(posedge clk or negedge reset_n)
  4301. begin
  4302. if (reset_n == 0)
  4303. R_ctrl_exception <= 0;
  4304. else if (R_en)
  4305. R_ctrl_exception <= R_ctrl_exception_nxt;
  4306. end
  4307. assign D_ctrl_break = D_op_break|D_op_hbreak;
  4308. assign R_ctrl_break_nxt = D_ctrl_break;
  4309. always @(posedge clk or negedge reset_n)
  4310. begin
  4311. if (reset_n == 0)
  4312. R_ctrl_break <= 0;
  4313. else if (R_en)
  4314. R_ctrl_break <= R_ctrl_break_nxt;
  4315. end
  4316. assign D_ctrl_crst = 1'b0;
  4317. assign R_ctrl_crst_nxt = D_ctrl_crst;
  4318. always @(posedge clk or negedge reset_n)
  4319. begin
  4320. if (reset_n == 0)
  4321. R_ctrl_crst <= 0;
  4322. else if (R_en)
  4323. R_ctrl_crst <= R_ctrl_crst_nxt;
  4324. end
  4325. assign D_ctrl_rd_ctl_reg = D_op_rdctl;
  4326. assign R_ctrl_rd_ctl_reg_nxt = D_ctrl_rd_ctl_reg;
  4327. always @(posedge clk or negedge reset_n)
  4328. begin
  4329. if (reset_n == 0)
  4330. R_ctrl_rd_ctl_reg <= 0;
  4331. else if (R_en)
  4332. R_ctrl_rd_ctl_reg <= R_ctrl_rd_ctl_reg_nxt;
  4333. end
  4334. assign D_ctrl_uncond_cti_non_br = D_op_call|D_op_jmpi|D_op_eret|D_op_bret|D_op_ret|D_op_jmp|D_op_callr;
  4335. assign R_ctrl_uncond_cti_non_br_nxt = D_ctrl_uncond_cti_non_br;
  4336. always @(posedge clk or negedge reset_n)
  4337. begin
  4338. if (reset_n == 0)
  4339. R_ctrl_uncond_cti_non_br <= 0;
  4340. else if (R_en)
  4341. R_ctrl_uncond_cti_non_br <= R_ctrl_uncond_cti_non_br_nxt;
  4342. end
  4343. assign D_ctrl_retaddr = D_op_call|
  4344. D_op_op_rsv02|
  4345. D_op_nextpc|
  4346. D_op_callr|
  4347. D_op_trap|
  4348. D_op_opx_rsv44|
  4349. D_op_div|
  4350. D_op_divu|
  4351. D_op_mul|
  4352. D_op_muli|
  4353. D_op_mulxss|
  4354. D_op_mulxsu|
  4355. D_op_mulxuu|
  4356. D_op_crst|
  4357. D_op_ldl|
  4358. D_op_op_rsv09|
  4359. D_op_op_rsv10|
  4360. D_op_op_rsv17|
  4361. D_op_op_rsv18|
  4362. D_op_op_rsv25|
  4363. D_op_op_rsv26|
  4364. D_op_op_rsv33|
  4365. D_op_op_rsv34|
  4366. D_op_op_rsv41|
  4367. D_op_op_rsv42|
  4368. D_op_op_rsv49|
  4369. D_op_op_rsv57|
  4370. D_op_op_rsv61|
  4371. D_op_op_rsv62|
  4372. D_op_op_rsv63|
  4373. D_op_opx_rsv00|
  4374. D_op_opx_rsv10|
  4375. D_op_opx_rsv15|
  4376. D_op_opx_rsv17|
  4377. D_op_opx_rsv21|
  4378. D_op_opx_rsv25|
  4379. D_op_opx_rsv33|
  4380. D_op_opx_rsv34|
  4381. D_op_opx_rsv35|
  4382. D_op_opx_rsv42|
  4383. D_op_opx_rsv43|
  4384. D_op_opx_rsv47|
  4385. D_op_opx_rsv50|
  4386. D_op_opx_rsv51|
  4387. D_op_opx_rsv55|
  4388. D_op_opx_rsv56|
  4389. D_op_opx_rsv60|
  4390. D_op_opx_rsv63|
  4391. D_op_rdprs|
  4392. D_op_stc|
  4393. D_op_wrprs|
  4394. D_op_intr|
  4395. D_op_break|
  4396. D_op_hbreak;
  4397. assign R_ctrl_retaddr_nxt = D_ctrl_retaddr;
  4398. always @(posedge clk or negedge reset_n)
  4399. begin
  4400. if (reset_n == 0)
  4401. R_ctrl_retaddr <= 0;
  4402. else if (R_en)
  4403. R_ctrl_retaddr <= R_ctrl_retaddr_nxt;
  4404. end
  4405. assign D_ctrl_shift_logical = D_op_slli|D_op_sll|D_op_srli|D_op_srl;
  4406. assign R_ctrl_shift_logical_nxt = D_ctrl_shift_logical;
  4407. always @(posedge clk or negedge reset_n)
  4408. begin
  4409. if (reset_n == 0)
  4410. R_ctrl_shift_logical <= 0;
  4411. else if (R_en)
  4412. R_ctrl_shift_logical <= R_ctrl_shift_logical_nxt;
  4413. end
  4414. assign D_ctrl_shift_right_arith = D_op_srai|D_op_sra;
  4415. assign R_ctrl_shift_right_arith_nxt = D_ctrl_shift_right_arith;
  4416. always @(posedge clk or negedge reset_n)
  4417. begin
  4418. if (reset_n == 0)
  4419. R_ctrl_shift_right_arith <= 0;
  4420. else if (R_en)
  4421. R_ctrl_shift_right_arith <= R_ctrl_shift_right_arith_nxt;
  4422. end
  4423. assign D_ctrl_rot_right = D_op_ror;
  4424. assign R_ctrl_rot_right_nxt = D_ctrl_rot_right;
  4425. always @(posedge clk or negedge reset_n)
  4426. begin
  4427. if (reset_n == 0)
  4428. R_ctrl_rot_right <= 0;
  4429. else if (R_en)
  4430. R_ctrl_rot_right <= R_ctrl_rot_right_nxt;
  4431. end
  4432. assign D_ctrl_shift_rot_right = D_op_srli|D_op_srl|D_op_srai|D_op_sra|D_op_ror;
  4433. assign R_ctrl_shift_rot_right_nxt = D_ctrl_shift_rot_right;
  4434. always @(posedge clk or negedge reset_n)
  4435. begin
  4436. if (reset_n == 0)
  4437. R_ctrl_shift_rot_right <= 0;
  4438. else if (R_en)
  4439. R_ctrl_shift_rot_right <= R_ctrl_shift_rot_right_nxt;
  4440. end
  4441. assign D_ctrl_shift_rot = D_op_slli|
  4442. D_op_sll|
  4443. D_op_roli|
  4444. D_op_rol|
  4445. D_op_srli|
  4446. D_op_srl|
  4447. D_op_srai|
  4448. D_op_sra|
  4449. D_op_ror;
  4450. assign R_ctrl_shift_rot_nxt = D_ctrl_shift_rot;
  4451. always @(posedge clk or negedge reset_n)
  4452. begin
  4453. if (reset_n == 0)
  4454. R_ctrl_shift_rot <= 0;
  4455. else if (R_en)
  4456. R_ctrl_shift_rot <= R_ctrl_shift_rot_nxt;
  4457. end
  4458. assign D_ctrl_logic = D_op_and|
  4459. D_op_or|
  4460. D_op_xor|
  4461. D_op_nor|
  4462. D_op_andhi|
  4463. D_op_orhi|
  4464. D_op_xorhi|
  4465. D_op_andi|
  4466. D_op_ori|
  4467. D_op_xori;
  4468. assign R_ctrl_logic_nxt = D_ctrl_logic;
  4469. always @(posedge clk or negedge reset_n)
  4470. begin
  4471. if (reset_n == 0)
  4472. R_ctrl_logic <= 0;
  4473. else if (R_en)
  4474. R_ctrl_logic <= R_ctrl_logic_nxt;
  4475. end
  4476. assign D_ctrl_hi_imm16 = D_op_andhi|D_op_orhi|D_op_xorhi;
  4477. assign R_ctrl_hi_imm16_nxt = D_ctrl_hi_imm16;
  4478. always @(posedge clk or negedge reset_n)
  4479. begin
  4480. if (reset_n == 0)
  4481. R_ctrl_hi_imm16 <= 0;
  4482. else if (R_en)
  4483. R_ctrl_hi_imm16 <= R_ctrl_hi_imm16_nxt;
  4484. end
  4485. assign D_ctrl_set_src2_rem_imm = 1'b0;
  4486. assign R_ctrl_set_src2_rem_imm_nxt = D_ctrl_set_src2_rem_imm;
  4487. always @(posedge clk or negedge reset_n)
  4488. begin
  4489. if (reset_n == 0)
  4490. R_ctrl_set_src2_rem_imm <= 0;
  4491. else if (R_en)
  4492. R_ctrl_set_src2_rem_imm <= R_ctrl_set_src2_rem_imm_nxt;
  4493. end
  4494. assign D_ctrl_unsigned_lo_imm16 = D_op_cmpgeui|
  4495. D_op_cmpltui|
  4496. D_op_andi|
  4497. D_op_ori|
  4498. D_op_xori|
  4499. D_op_roli|
  4500. D_op_slli|
  4501. D_op_srli|
  4502. D_op_srai;
  4503. assign R_ctrl_unsigned_lo_imm16_nxt = D_ctrl_unsigned_lo_imm16;
  4504. always @(posedge clk or negedge reset_n)
  4505. begin
  4506. if (reset_n == 0)
  4507. R_ctrl_unsigned_lo_imm16 <= 0;
  4508. else if (R_en)
  4509. R_ctrl_unsigned_lo_imm16 <= R_ctrl_unsigned_lo_imm16_nxt;
  4510. end
  4511. assign D_ctrl_signed_imm12 = 1'b0;
  4512. assign R_ctrl_signed_imm12_nxt = D_ctrl_signed_imm12;
  4513. always @(posedge clk or negedge reset_n)
  4514. begin
  4515. if (reset_n == 0)
  4516. R_ctrl_signed_imm12 <= 0;
  4517. else if (R_en)
  4518. R_ctrl_signed_imm12 <= R_ctrl_signed_imm12_nxt;
  4519. end
  4520. assign D_ctrl_src_imm5_shift_rot = D_op_roli|D_op_slli|D_op_srli|D_op_srai;
  4521. assign R_ctrl_src_imm5_shift_rot_nxt = D_ctrl_src_imm5_shift_rot;
  4522. always @(posedge clk or negedge reset_n)
  4523. begin
  4524. if (reset_n == 0)
  4525. R_ctrl_src_imm5_shift_rot <= 0;
  4526. else if (R_en)
  4527. R_ctrl_src_imm5_shift_rot <= R_ctrl_src_imm5_shift_rot_nxt;
  4528. end
  4529. assign D_ctrl_br_uncond = D_op_br;
  4530. assign R_ctrl_br_uncond_nxt = D_ctrl_br_uncond;
  4531. always @(posedge clk or negedge reset_n)
  4532. begin
  4533. if (reset_n == 0)
  4534. R_ctrl_br_uncond <= 0;
  4535. else if (R_en)
  4536. R_ctrl_br_uncond <= R_ctrl_br_uncond_nxt;
  4537. end
  4538. assign D_ctrl_br = D_op_br|D_op_bge|D_op_blt|D_op_bne|D_op_beq|D_op_bgeu|D_op_bltu;
  4539. assign R_ctrl_br_nxt = D_ctrl_br;
  4540. always @(posedge clk or negedge reset_n)
  4541. begin
  4542. if (reset_n == 0)
  4543. R_ctrl_br <= 0;
  4544. else if (R_en)
  4545. R_ctrl_br <= R_ctrl_br_nxt;
  4546. end
  4547. assign D_ctrl_alu_subtract = D_op_sub|
  4548. D_op_cmplti|
  4549. D_op_cmpltui|
  4550. D_op_cmplt|
  4551. D_op_cmpltu|
  4552. D_op_blt|
  4553. D_op_bltu|
  4554. D_op_cmpgei|
  4555. D_op_cmpgeui|
  4556. D_op_cmpge|
  4557. D_op_cmpgeu|
  4558. D_op_bge|
  4559. D_op_bgeu;
  4560. assign R_ctrl_alu_subtract_nxt = D_ctrl_alu_subtract;
  4561. always @(posedge clk or negedge reset_n)
  4562. begin
  4563. if (reset_n == 0)
  4564. R_ctrl_alu_subtract <= 0;
  4565. else if (R_en)
  4566. R_ctrl_alu_subtract <= R_ctrl_alu_subtract_nxt;
  4567. end
  4568. assign D_ctrl_alu_signed_comparison = D_op_cmpge|D_op_cmpgei|D_op_cmplt|D_op_cmplti|D_op_bge|D_op_blt;
  4569. assign R_ctrl_alu_signed_comparison_nxt = D_ctrl_alu_signed_comparison;
  4570. always @(posedge clk or negedge reset_n)
  4571. begin
  4572. if (reset_n == 0)
  4573. R_ctrl_alu_signed_comparison <= 0;
  4574. else if (R_en)
  4575. R_ctrl_alu_signed_comparison <= R_ctrl_alu_signed_comparison_nxt;
  4576. end
  4577. assign D_ctrl_br_cmp = D_op_br|
  4578. D_op_bge|
  4579. D_op_blt|
  4580. D_op_bne|
  4581. D_op_beq|
  4582. D_op_bgeu|
  4583. D_op_bltu|
  4584. D_op_cmpgei|
  4585. D_op_cmplti|
  4586. D_op_cmpnei|
  4587. D_op_cmpgeui|
  4588. D_op_cmpltui|
  4589. D_op_cmpeqi|
  4590. D_op_cmpge|
  4591. D_op_cmplt|
  4592. D_op_cmpne|
  4593. D_op_cmpgeu|
  4594. D_op_cmpltu|
  4595. D_op_cmpeq;
  4596. assign R_ctrl_br_cmp_nxt = D_ctrl_br_cmp;
  4597. always @(posedge clk or negedge reset_n)
  4598. begin
  4599. if (reset_n == 0)
  4600. R_ctrl_br_cmp <= 0;
  4601. else if (R_en)
  4602. R_ctrl_br_cmp <= R_ctrl_br_cmp_nxt;
  4603. end
  4604. assign D_ctrl_ld_signed = D_op_ldb|D_op_ldh|D_op_ldw|D_op_ldbio|D_op_ldhio|D_op_ldwio;
  4605. assign R_ctrl_ld_signed_nxt = D_ctrl_ld_signed;
  4606. always @(posedge clk or negedge reset_n)
  4607. begin
  4608. if (reset_n == 0)
  4609. R_ctrl_ld_signed <= 0;
  4610. else if (R_en)
  4611. R_ctrl_ld_signed <= R_ctrl_ld_signed_nxt;
  4612. end
  4613. assign D_ctrl_ld = D_op_ldb|
  4614. D_op_ldh|
  4615. D_op_ldw|
  4616. D_op_ldbio|
  4617. D_op_ldhio|
  4618. D_op_ldwio|
  4619. D_op_ldbu|
  4620. D_op_ldhu|
  4621. D_op_ldbuio|
  4622. D_op_ldhuio;
  4623. assign R_ctrl_ld_nxt = D_ctrl_ld;
  4624. always @(posedge clk or negedge reset_n)
  4625. begin
  4626. if (reset_n == 0)
  4627. R_ctrl_ld <= 0;
  4628. else if (R_en)
  4629. R_ctrl_ld <= R_ctrl_ld_nxt;
  4630. end
  4631. assign D_ctrl_ld_ex = 1'b0;
  4632. assign R_ctrl_ld_ex_nxt = D_ctrl_ld_ex;
  4633. always @(posedge clk or negedge reset_n)
  4634. begin
  4635. if (reset_n == 0)
  4636. R_ctrl_ld_ex <= 0;
  4637. else if (R_en)
  4638. R_ctrl_ld_ex <= R_ctrl_ld_ex_nxt;
  4639. end
  4640. assign D_ctrl_ld_non_io = D_op_ldbu|D_op_ldhu|D_op_ldb|D_op_ldh|D_op_ldw;
  4641. assign R_ctrl_ld_non_io_nxt = D_ctrl_ld_non_io;
  4642. always @(posedge clk or negedge reset_n)
  4643. begin
  4644. if (reset_n == 0)
  4645. R_ctrl_ld_non_io <= 0;
  4646. else if (R_en)
  4647. R_ctrl_ld_non_io <= R_ctrl_ld_non_io_nxt;
  4648. end
  4649. assign D_ctrl_st_ex = 1'b0;
  4650. assign R_ctrl_st_ex_nxt = D_ctrl_st_ex;
  4651. always @(posedge clk or negedge reset_n)
  4652. begin
  4653. if (reset_n == 0)
  4654. R_ctrl_st_ex <= 0;
  4655. else if (R_en)
  4656. R_ctrl_st_ex <= R_ctrl_st_ex_nxt;
  4657. end
  4658. assign D_ctrl_st = D_op_stb|D_op_sth|D_op_stw|D_op_stbio|D_op_sthio|D_op_stwio;
  4659. assign R_ctrl_st_nxt = D_ctrl_st;
  4660. always @(posedge clk or negedge reset_n)
  4661. begin
  4662. if (reset_n == 0)
  4663. R_ctrl_st <= 0;
  4664. else if (R_en)
  4665. R_ctrl_st <= R_ctrl_st_nxt;
  4666. end
  4667. assign D_ctrl_ld_st_ex = 1'b0;
  4668. assign R_ctrl_ld_st_ex_nxt = D_ctrl_ld_st_ex;
  4669. always @(posedge clk or negedge reset_n)
  4670. begin
  4671. if (reset_n == 0)
  4672. R_ctrl_ld_st_ex <= 0;
  4673. else if (R_en)
  4674. R_ctrl_ld_st_ex <= R_ctrl_ld_st_ex_nxt;
  4675. end
  4676. assign D_ctrl_mem8 = D_op_ldb|D_op_ldbu|D_op_ldbio|D_op_ldbuio|D_op_stb|D_op_stbio;
  4677. assign R_ctrl_mem8_nxt = D_ctrl_mem8;
  4678. always @(posedge clk or negedge reset_n)
  4679. begin
  4680. if (reset_n == 0)
  4681. R_ctrl_mem8 <= 0;
  4682. else if (R_en)
  4683. R_ctrl_mem8 <= R_ctrl_mem8_nxt;
  4684. end
  4685. assign D_ctrl_mem16 = D_op_ldhu|D_op_ldh|D_op_ldhio|D_op_ldhuio|D_op_sth|D_op_sthio;
  4686. assign R_ctrl_mem16_nxt = D_ctrl_mem16;
  4687. always @(posedge clk or negedge reset_n)
  4688. begin
  4689. if (reset_n == 0)
  4690. R_ctrl_mem16 <= 0;
  4691. else if (R_en)
  4692. R_ctrl_mem16 <= R_ctrl_mem16_nxt;
  4693. end
  4694. assign D_ctrl_mem32 = D_op_ldw|D_op_ldwio|D_op_stw|D_op_stwio;
  4695. assign R_ctrl_mem32_nxt = D_ctrl_mem32;
  4696. always @(posedge clk or negedge reset_n)
  4697. begin
  4698. if (reset_n == 0)
  4699. R_ctrl_mem32 <= 0;
  4700. else if (R_en)
  4701. R_ctrl_mem32 <= R_ctrl_mem32_nxt;
  4702. end
  4703. assign D_ctrl_ld_io = D_op_ldbuio|D_op_ldhuio|D_op_ldbio|D_op_ldhio|D_op_ldwio;
  4704. assign R_ctrl_ld_io_nxt = D_ctrl_ld_io;
  4705. always @(posedge clk or negedge reset_n)
  4706. begin
  4707. if (reset_n == 0)
  4708. R_ctrl_ld_io <= 0;
  4709. else if (R_en)
  4710. R_ctrl_ld_io <= R_ctrl_ld_io_nxt;
  4711. end
  4712. assign D_ctrl_b_is_dst = (D_op_addi|
  4713. D_op_andhi|
  4714. D_op_orhi|
  4715. D_op_xorhi|
  4716. D_op_andi|
  4717. D_op_ori|
  4718. D_op_xori|
  4719. D_op_call|
  4720. D_op_cmpgei|
  4721. D_op_cmplti|
  4722. D_op_cmpnei|
  4723. D_op_cmpgeui|
  4724. D_op_cmpltui|
  4725. D_op_cmpeqi|
  4726. D_op_jmpi|
  4727. D_op_ldb|
  4728. D_op_ldh|
  4729. D_op_ldw|
  4730. D_op_ldbio|
  4731. D_op_ldhio|
  4732. D_op_ldwio|
  4733. D_op_ldbu|
  4734. D_op_ldhu|
  4735. D_op_ldbuio|
  4736. D_op_ldhuio|
  4737. D_op_initd|
  4738. D_op_initda|
  4739. D_op_flushd|
  4740. D_op_flushda) & ~D_op_custom;
  4741. assign R_ctrl_b_is_dst_nxt = D_ctrl_b_is_dst;
  4742. always @(posedge clk or negedge reset_n)
  4743. begin
  4744. if (reset_n == 0)
  4745. R_ctrl_b_is_dst <= 0;
  4746. else if (R_en)
  4747. R_ctrl_b_is_dst <= R_ctrl_b_is_dst_nxt;
  4748. end
  4749. assign D_ctrl_ignore_dst = (D_op_br|
  4750. D_op_bge|
  4751. D_op_blt|
  4752. D_op_bne|
  4753. D_op_beq|
  4754. D_op_bgeu|
  4755. D_op_bltu|
  4756. D_op_stb|
  4757. D_op_sth|
  4758. D_op_stw|
  4759. D_op_stbio|
  4760. D_op_sthio|
  4761. D_op_stwio|
  4762. D_op_jmpi) | (D_op_custom & ~D_iw_custom_writerc);
  4763. assign R_ctrl_ignore_dst_nxt = D_ctrl_ignore_dst;
  4764. always @(posedge clk or negedge reset_n)
  4765. begin
  4766. if (reset_n == 0)
  4767. R_ctrl_ignore_dst <= 0;
  4768. else if (R_en)
  4769. R_ctrl_ignore_dst <= R_ctrl_ignore_dst_nxt;
  4770. end
  4771. assign D_ctrl_src2_choose_imm = D_op_addi|
  4772. D_op_andhi|
  4773. D_op_orhi|
  4774. D_op_xorhi|
  4775. D_op_andi|
  4776. D_op_ori|
  4777. D_op_xori|
  4778. D_op_call|
  4779. D_op_cmpgei|
  4780. D_op_cmplti|
  4781. D_op_cmpnei|
  4782. D_op_cmpgeui|
  4783. D_op_cmpltui|
  4784. D_op_cmpeqi|
  4785. D_op_jmpi|
  4786. D_op_ldb|
  4787. D_op_ldh|
  4788. D_op_ldw|
  4789. D_op_ldbio|
  4790. D_op_ldhio|
  4791. D_op_ldwio|
  4792. D_op_ldbu|
  4793. D_op_ldhu|
  4794. D_op_ldbuio|
  4795. D_op_ldhuio|
  4796. D_op_initd|
  4797. D_op_initda|
  4798. D_op_flushd|
  4799. D_op_flushda|
  4800. D_op_stb|
  4801. D_op_sth|
  4802. D_op_stw|
  4803. D_op_stbio|
  4804. D_op_sthio|
  4805. D_op_stwio|
  4806. D_op_roli|
  4807. D_op_slli|
  4808. D_op_srli|
  4809. D_op_srai;
  4810. assign R_ctrl_src2_choose_imm_nxt = D_ctrl_src2_choose_imm;
  4811. always @(posedge clk or negedge reset_n)
  4812. begin
  4813. if (reset_n == 0)
  4814. R_ctrl_src2_choose_imm <= 0;
  4815. else if (R_en)
  4816. R_ctrl_src2_choose_imm <= R_ctrl_src2_choose_imm_nxt;
  4817. end
  4818. assign D_ctrl_wrctl_inst = D_op_wrctl;
  4819. assign R_ctrl_wrctl_inst_nxt = D_ctrl_wrctl_inst;
  4820. always @(posedge clk or negedge reset_n)
  4821. begin
  4822. if (reset_n == 0)
  4823. R_ctrl_wrctl_inst <= 0;
  4824. else if (R_en)
  4825. R_ctrl_wrctl_inst <= R_ctrl_wrctl_inst_nxt;
  4826. end
  4827. assign D_ctrl_intr_inst = 1'b0;
  4828. assign R_ctrl_intr_inst_nxt = D_ctrl_intr_inst;
  4829. always @(posedge clk or negedge reset_n)
  4830. begin
  4831. if (reset_n == 0)
  4832. R_ctrl_intr_inst <= 0;
  4833. else if (R_en)
  4834. R_ctrl_intr_inst <= R_ctrl_intr_inst_nxt;
  4835. end
  4836. assign D_ctrl_force_src2_zero = D_op_call|
  4837. D_op_op_rsv02|
  4838. D_op_nextpc|
  4839. D_op_callr|
  4840. D_op_trap|
  4841. D_op_opx_rsv44|
  4842. D_op_crst|
  4843. D_op_ldl|
  4844. D_op_op_rsv09|
  4845. D_op_op_rsv10|
  4846. D_op_op_rsv17|
  4847. D_op_op_rsv18|
  4848. D_op_op_rsv25|
  4849. D_op_op_rsv26|
  4850. D_op_op_rsv33|
  4851. D_op_op_rsv34|
  4852. D_op_op_rsv41|
  4853. D_op_op_rsv42|
  4854. D_op_op_rsv49|
  4855. D_op_op_rsv57|
  4856. D_op_op_rsv61|
  4857. D_op_op_rsv62|
  4858. D_op_op_rsv63|
  4859. D_op_opx_rsv00|
  4860. D_op_opx_rsv10|
  4861. D_op_opx_rsv15|
  4862. D_op_opx_rsv17|
  4863. D_op_opx_rsv21|
  4864. D_op_opx_rsv25|
  4865. D_op_opx_rsv33|
  4866. D_op_opx_rsv34|
  4867. D_op_opx_rsv35|
  4868. D_op_opx_rsv42|
  4869. D_op_opx_rsv43|
  4870. D_op_opx_rsv47|
  4871. D_op_opx_rsv50|
  4872. D_op_opx_rsv51|
  4873. D_op_opx_rsv55|
  4874. D_op_opx_rsv56|
  4875. D_op_opx_rsv60|
  4876. D_op_opx_rsv63|
  4877. D_op_rdprs|
  4878. D_op_stc|
  4879. D_op_wrprs|
  4880. D_op_intr|
  4881. D_op_break|
  4882. D_op_hbreak|
  4883. D_op_eret|
  4884. D_op_bret|
  4885. D_op_ret|
  4886. D_op_jmp|
  4887. D_op_jmpi;
  4888. assign R_ctrl_force_src2_zero_nxt = D_ctrl_force_src2_zero;
  4889. always @(posedge clk or negedge reset_n)
  4890. begin
  4891. if (reset_n == 0)
  4892. R_ctrl_force_src2_zero <= 0;
  4893. else if (R_en)
  4894. R_ctrl_force_src2_zero <= R_ctrl_force_src2_zero_nxt;
  4895. end
  4896. assign D_ctrl_alu_force_xor = D_op_cmpgei|
  4897. D_op_cmpgeui|
  4898. D_op_cmpeqi|
  4899. D_op_cmpge|
  4900. D_op_cmpgeu|
  4901. D_op_cmpeq|
  4902. D_op_cmpnei|
  4903. D_op_cmpne|
  4904. D_op_bge|
  4905. D_op_bgeu|
  4906. D_op_beq|
  4907. D_op_bne|
  4908. D_op_br;
  4909. assign R_ctrl_alu_force_xor_nxt = D_ctrl_alu_force_xor;
  4910. always @(posedge clk or negedge reset_n)
  4911. begin
  4912. if (reset_n == 0)
  4913. R_ctrl_alu_force_xor <= 0;
  4914. else if (R_en)
  4915. R_ctrl_alu_force_xor <= R_ctrl_alu_force_xor_nxt;
  4916. end
  4917. assign D_ctrl_alu_force_and = 1'b0;
  4918. assign R_ctrl_alu_force_and_nxt = D_ctrl_alu_force_and;
  4919. always @(posedge clk or negedge reset_n)
  4920. begin
  4921. if (reset_n == 0)
  4922. R_ctrl_alu_force_and <= 0;
  4923. else if (R_en)
  4924. R_ctrl_alu_force_and <= R_ctrl_alu_force_and_nxt;
  4925. end
  4926. //data_master, which is an e_avalon_master
  4927. //instruction_master, which is an e_avalon_master
  4928. //synthesis translate_off
  4929. //////////////// SIMULATION-ONLY CONTENTS
  4930. assign F_inst = (F_op_call)? 272'h20202020202020202020202020202020202020202020202020202020202063616c6c :
  4931. (F_op_jmpi)? 272'h2020202020202020202020202020202020202020202020202020202020206a6d7069 :
  4932. (F_op_ldbu)? 272'h2020202020202020202020202020202020202020202020202020202020206c646275 :
  4933. (F_op_addi)? 272'h20202020202020202020202020202020202020202020202020202020202061646469 :
  4934. (F_op_stb)? 272'h20202020202020202020202020202020202020202020202020202020202020737462 :
  4935. (F_op_br)? 272'h20202020202020202020202020202020202020202020202020202020202020206272 :
  4936. (F_op_ldb)? 272'h202020202020202020202020202020202020202020202020202020202020206c6462 :
  4937. (F_op_cmpgei)? 272'h20202020202020202020202020202020202020202020202020202020636d70676569 :
  4938. (F_op_ldhu)? 272'h2020202020202020202020202020202020202020202020202020202020206c646875 :
  4939. (F_op_andi)? 272'h202020202020202020202020202020202020202020202020202020202020616e6469 :
  4940. (F_op_sth)? 272'h20202020202020202020202020202020202020202020202020202020202020737468 :
  4941. (F_op_bge)? 272'h20202020202020202020202020202020202020202020202020202020202020626765 :
  4942. (F_op_ldh)? 272'h202020202020202020202020202020202020202020202020202020202020206c6468 :
  4943. (F_op_cmplti)? 272'h20202020202020202020202020202020202020202020202020202020636d706c7469 :
  4944. (F_op_initda)? 272'h20202020202020202020202020202020202020202020202020202020696e69746461 :
  4945. (F_op_ori)? 272'h202020202020202020202020202020202020202020202020202020202020206f7269 :
  4946. (F_op_stw)? 272'h20202020202020202020202020202020202020202020202020202020202020737477 :
  4947. (F_op_blt)? 272'h20202020202020202020202020202020202020202020202020202020202020626c74 :
  4948. (F_op_ldw)? 272'h202020202020202020202020202020202020202020202020202020202020206c6477 :
  4949. (F_op_cmpnei)? 272'h20202020202020202020202020202020202020202020202020202020636d706e6569 :
  4950. (F_op_flushda)? 272'h202020202020202020202020202020202020202020202020202020666c7573686461 :
  4951. (F_op_xori)? 272'h202020202020202020202020202020202020202020202020202020202020786f7269 :
  4952. (F_op_bne)? 272'h20202020202020202020202020202020202020202020202020202020202020626e65 :
  4953. (F_op_cmpeqi)? 272'h20202020202020202020202020202020202020202020202020202020636d70657169 :
  4954. (F_op_ldbuio)? 272'h202020202020202020202020202020202020202020202020202020206c646275696f :
  4955. (F_op_muli)? 272'h2020202020202020202020202020202020202020202020202020202020206d756c69 :
  4956. (F_op_stbio)? 272'h2020202020202020202020202020202020202020202020202020202020737462696f :
  4957. (F_op_beq)? 272'h20202020202020202020202020202020202020202020202020202020202020626571 :
  4958. (F_op_ldbio)? 272'h20202020202020202020202020202020202020202020202020202020206c6462696f :
  4959. (F_op_cmpgeui)? 272'h202020202020202020202020202020202020202020202020202020636d7067657569 :
  4960. (F_op_ldhuio)? 272'h202020202020202020202020202020202020202020202020202020206c646875696f :
  4961. (F_op_andhi)? 272'h2020202020202020202020202020202020202020202020202020202020616e646869 :
  4962. (F_op_sthio)? 272'h2020202020202020202020202020202020202020202020202020202020737468696f :
  4963. (F_op_bgeu)? 272'h20202020202020202020202020202020202020202020202020202020202062676575 :
  4964. (F_op_ldhio)? 272'h20202020202020202020202020202020202020202020202020202020206c6468696f :
  4965. (F_op_cmpltui)? 272'h202020202020202020202020202020202020202020202020202020636d706c747569 :
  4966. (F_op_custom)? 272'h20202020202020202020202020202020202020202020202020202020637573746f6d :
  4967. (F_op_initd)? 272'h2020202020202020202020202020202020202020202020202020202020696e697464 :
  4968. (F_op_orhi)? 272'h2020202020202020202020202020202020202020202020202020202020206f726869 :
  4969. (F_op_stwio)? 272'h2020202020202020202020202020202020202020202020202020202020737477696f :
  4970. (F_op_bltu)? 272'h202020202020202020202020202020202020202020202020202020202020626c7475 :
  4971. (F_op_ldwio)? 272'h20202020202020202020202020202020202020202020202020202020206c6477696f :
  4972. (F_op_flushd)? 272'h20202020202020202020202020202020202020202020202020202020666c75736864 :
  4973. (F_op_xorhi)? 272'h2020202020202020202020202020202020202020202020202020202020786f726869 :
  4974. (F_op_eret)? 272'h20202020202020202020202020202020202020202020202020202020202065726574 :
  4975. (F_op_roli)? 272'h202020202020202020202020202020202020202020202020202020202020726f6c69 :
  4976. (F_op_rol)? 272'h20202020202020202020202020202020202020202020202020202020202020726f6c :
  4977. (F_op_flushp)? 272'h20202020202020202020202020202020202020202020202020202020666c75736870 :
  4978. (F_op_ret)? 272'h20202020202020202020202020202020202020202020202020202020202020726574 :
  4979. (F_op_nor)? 272'h202020202020202020202020202020202020202020202020202020202020206e6f72 :
  4980. (F_op_mulxuu)? 272'h202020202020202020202020202020202020202020202020202020206d756c787575 :
  4981. (F_op_cmpge)? 272'h2020202020202020202020202020202020202020202020202020202020636d706765 :
  4982. (F_op_bret)? 272'h20202020202020202020202020202020202020202020202020202020202062726574 :
  4983. (F_op_ror)? 272'h20202020202020202020202020202020202020202020202020202020202020726f72 :
  4984. (F_op_flushi)? 272'h20202020202020202020202020202020202020202020202020202020666c75736869 :
  4985. (F_op_jmp)? 272'h202020202020202020202020202020202020202020202020202020202020206a6d70 :
  4986. (F_op_and)? 272'h20202020202020202020202020202020202020202020202020202020202020616e64 :
  4987. (F_op_cmplt)? 272'h2020202020202020202020202020202020202020202020202020202020636d706c74 :
  4988. (F_op_slli)? 272'h202020202020202020202020202020202020202020202020202020202020736c6c69 :
  4989. (F_op_sll)? 272'h20202020202020202020202020202020202020202020202020202020202020736c6c :
  4990. (F_op_or)? 272'h20202020202020202020202020202020202020202020202020202020202020206f72 :
  4991. (F_op_mulxsu)? 272'h202020202020202020202020202020202020202020202020202020206d756c787375 :
  4992. (F_op_cmpne)? 272'h2020202020202020202020202020202020202020202020202020202020636d706e65 :
  4993. (F_op_srli)? 272'h20202020202020202020202020202020202020202020202020202020202073726c69 :
  4994. (F_op_srl)? 272'h2020202020202020202020202020202020202020202020202020202020202073726c :
  4995. (F_op_nextpc)? 272'h202020202020202020202020202020202020202020202020202020206e6578747063 :
  4996. (F_op_callr)? 272'h202020202020202020202020202020202020202020202020202020202063616c6c72 :
  4997. (F_op_xor)? 272'h20202020202020202020202020202020202020202020202020202020202020786f72 :
  4998. (F_op_mulxss)? 272'h202020202020202020202020202020202020202020202020202020206d756c787373 :
  4999. (F_op_cmpeq)? 272'h2020202020202020202020202020202020202020202020202020202020636d706571 :
  5000. (F_op_divu)? 272'h20202020202020202020202020202020202020202020202020202020202064697675 :
  5001. (F_op_div)? 272'h20202020202020202020202020202020202020202020202020202020202020646976 :
  5002. (F_op_rdctl)? 272'h2020202020202020202020202020202020202020202020202020202020726463746c :
  5003. (F_op_mul)? 272'h202020202020202020202020202020202020202020202020202020202020206d756c :
  5004. (F_op_cmpgeu)? 272'h20202020202020202020202020202020202020202020202020202020636d70676575 :
  5005. (F_op_initi)? 272'h2020202020202020202020202020202020202020202020202020202020696e697469 :
  5006. (F_op_trap)? 272'h20202020202020202020202020202020202020202020202020202020202074726170 :
  5007. (F_op_wrctl)? 272'h2020202020202020202020202020202020202020202020202020202020777263746c :
  5008. (F_op_cmpltu)? 272'h20202020202020202020202020202020202020202020202020202020636d706c7475 :
  5009. (F_op_add)? 272'h20202020202020202020202020202020202020202020202020202020202020616464 :
  5010. (F_op_break)? 272'h2020202020202020202020202020202020202020202020202020202020627265616b :
  5011. (F_op_hbreak)? 272'h2020202020202020202020202020202020202020202020202020202068627265616b :
  5012. (F_op_sync)? 272'h20202020202020202020202020202020202020202020202020202020202073796e63 :
  5013. (F_op_sub)? 272'h20202020202020202020202020202020202020202020202020202020202020737562 :
  5014. (F_op_srai)? 272'h20202020202020202020202020202020202020202020202020202020202073726169 :
  5015. (F_op_sra)? 272'h20202020202020202020202020202020202020202020202020202020202020737261 :
  5016. (F_op_intr)? 272'h202020202020202020202020202020202020202020202020202020202020696e7472 :
  5017. (F_op_nios_custom_instr_floating_point_0)? 272'h6e696f735f637573746f6d5f696e7374725f666c6f6174696e675f706f696e745f30 :
  5018. 272'h20202020202020202020202020202020202020202020202020202020202020424144;
  5019. assign D_inst = (D_op_call)? 272'h20202020202020202020202020202020202020202020202020202020202063616c6c :
  5020. (D_op_jmpi)? 272'h2020202020202020202020202020202020202020202020202020202020206a6d7069 :
  5021. (D_op_ldbu)? 272'h2020202020202020202020202020202020202020202020202020202020206c646275 :
  5022. (D_op_addi)? 272'h20202020202020202020202020202020202020202020202020202020202061646469 :
  5023. (D_op_stb)? 272'h20202020202020202020202020202020202020202020202020202020202020737462 :
  5024. (D_op_br)? 272'h20202020202020202020202020202020202020202020202020202020202020206272 :
  5025. (D_op_ldb)? 272'h202020202020202020202020202020202020202020202020202020202020206c6462 :
  5026. (D_op_cmpgei)? 272'h20202020202020202020202020202020202020202020202020202020636d70676569 :
  5027. (D_op_ldhu)? 272'h2020202020202020202020202020202020202020202020202020202020206c646875 :
  5028. (D_op_andi)? 272'h202020202020202020202020202020202020202020202020202020202020616e6469 :
  5029. (D_op_sth)? 272'h20202020202020202020202020202020202020202020202020202020202020737468 :
  5030. (D_op_bge)? 272'h20202020202020202020202020202020202020202020202020202020202020626765 :
  5031. (D_op_ldh)? 272'h202020202020202020202020202020202020202020202020202020202020206c6468 :
  5032. (D_op_cmplti)? 272'h20202020202020202020202020202020202020202020202020202020636d706c7469 :
  5033. (D_op_initda)? 272'h20202020202020202020202020202020202020202020202020202020696e69746461 :
  5034. (D_op_ori)? 272'h202020202020202020202020202020202020202020202020202020202020206f7269 :
  5035. (D_op_stw)? 272'h20202020202020202020202020202020202020202020202020202020202020737477 :
  5036. (D_op_blt)? 272'h20202020202020202020202020202020202020202020202020202020202020626c74 :
  5037. (D_op_ldw)? 272'h202020202020202020202020202020202020202020202020202020202020206c6477 :
  5038. (D_op_cmpnei)? 272'h20202020202020202020202020202020202020202020202020202020636d706e6569 :
  5039. (D_op_flushda)? 272'h202020202020202020202020202020202020202020202020202020666c7573686461 :
  5040. (D_op_xori)? 272'h202020202020202020202020202020202020202020202020202020202020786f7269 :
  5041. (D_op_bne)? 272'h20202020202020202020202020202020202020202020202020202020202020626e65 :
  5042. (D_op_cmpeqi)? 272'h20202020202020202020202020202020202020202020202020202020636d70657169 :
  5043. (D_op_ldbuio)? 272'h202020202020202020202020202020202020202020202020202020206c646275696f :
  5044. (D_op_muli)? 272'h2020202020202020202020202020202020202020202020202020202020206d756c69 :
  5045. (D_op_stbio)? 272'h2020202020202020202020202020202020202020202020202020202020737462696f :
  5046. (D_op_beq)? 272'h20202020202020202020202020202020202020202020202020202020202020626571 :
  5047. (D_op_ldbio)? 272'h20202020202020202020202020202020202020202020202020202020206c6462696f :
  5048. (D_op_cmpgeui)? 272'h202020202020202020202020202020202020202020202020202020636d7067657569 :
  5049. (D_op_ldhuio)? 272'h202020202020202020202020202020202020202020202020202020206c646875696f :
  5050. (D_op_andhi)? 272'h2020202020202020202020202020202020202020202020202020202020616e646869 :
  5051. (D_op_sthio)? 272'h2020202020202020202020202020202020202020202020202020202020737468696f :
  5052. (D_op_bgeu)? 272'h20202020202020202020202020202020202020202020202020202020202062676575 :
  5053. (D_op_ldhio)? 272'h20202020202020202020202020202020202020202020202020202020206c6468696f :
  5054. (D_op_cmpltui)? 272'h202020202020202020202020202020202020202020202020202020636d706c747569 :
  5055. (D_op_custom)? 272'h20202020202020202020202020202020202020202020202020202020637573746f6d :
  5056. (D_op_initd)? 272'h2020202020202020202020202020202020202020202020202020202020696e697464 :
  5057. (D_op_orhi)? 272'h2020202020202020202020202020202020202020202020202020202020206f726869 :
  5058. (D_op_stwio)? 272'h2020202020202020202020202020202020202020202020202020202020737477696f :
  5059. (D_op_bltu)? 272'h202020202020202020202020202020202020202020202020202020202020626c7475 :
  5060. (D_op_ldwio)? 272'h20202020202020202020202020202020202020202020202020202020206c6477696f :
  5061. (D_op_flushd)? 272'h20202020202020202020202020202020202020202020202020202020666c75736864 :
  5062. (D_op_xorhi)? 272'h2020202020202020202020202020202020202020202020202020202020786f726869 :
  5063. (D_op_eret)? 272'h20202020202020202020202020202020202020202020202020202020202065726574 :
  5064. (D_op_roli)? 272'h202020202020202020202020202020202020202020202020202020202020726f6c69 :
  5065. (D_op_rol)? 272'h20202020202020202020202020202020202020202020202020202020202020726f6c :
  5066. (D_op_flushp)? 272'h20202020202020202020202020202020202020202020202020202020666c75736870 :
  5067. (D_op_ret)? 272'h20202020202020202020202020202020202020202020202020202020202020726574 :
  5068. (D_op_nor)? 272'h202020202020202020202020202020202020202020202020202020202020206e6f72 :
  5069. (D_op_mulxuu)? 272'h202020202020202020202020202020202020202020202020202020206d756c787575 :
  5070. (D_op_cmpge)? 272'h2020202020202020202020202020202020202020202020202020202020636d706765 :
  5071. (D_op_bret)? 272'h20202020202020202020202020202020202020202020202020202020202062726574 :
  5072. (D_op_ror)? 272'h20202020202020202020202020202020202020202020202020202020202020726f72 :
  5073. (D_op_flushi)? 272'h20202020202020202020202020202020202020202020202020202020666c75736869 :
  5074. (D_op_jmp)? 272'h202020202020202020202020202020202020202020202020202020202020206a6d70 :
  5075. (D_op_and)? 272'h20202020202020202020202020202020202020202020202020202020202020616e64 :
  5076. (D_op_cmplt)? 272'h2020202020202020202020202020202020202020202020202020202020636d706c74 :
  5077. (D_op_slli)? 272'h202020202020202020202020202020202020202020202020202020202020736c6c69 :
  5078. (D_op_sll)? 272'h20202020202020202020202020202020202020202020202020202020202020736c6c :
  5079. (D_op_or)? 272'h20202020202020202020202020202020202020202020202020202020202020206f72 :
  5080. (D_op_mulxsu)? 272'h202020202020202020202020202020202020202020202020202020206d756c787375 :
  5081. (D_op_cmpne)? 272'h2020202020202020202020202020202020202020202020202020202020636d706e65 :
  5082. (D_op_srli)? 272'h20202020202020202020202020202020202020202020202020202020202073726c69 :
  5083. (D_op_srl)? 272'h2020202020202020202020202020202020202020202020202020202020202073726c :
  5084. (D_op_nextpc)? 272'h202020202020202020202020202020202020202020202020202020206e6578747063 :
  5085. (D_op_callr)? 272'h202020202020202020202020202020202020202020202020202020202063616c6c72 :
  5086. (D_op_xor)? 272'h20202020202020202020202020202020202020202020202020202020202020786f72 :
  5087. (D_op_mulxss)? 272'h202020202020202020202020202020202020202020202020202020206d756c787373 :
  5088. (D_op_cmpeq)? 272'h2020202020202020202020202020202020202020202020202020202020636d706571 :
  5089. (D_op_divu)? 272'h20202020202020202020202020202020202020202020202020202020202064697675 :
  5090. (D_op_div)? 272'h20202020202020202020202020202020202020202020202020202020202020646976 :
  5091. (D_op_rdctl)? 272'h2020202020202020202020202020202020202020202020202020202020726463746c :
  5092. (D_op_mul)? 272'h202020202020202020202020202020202020202020202020202020202020206d756c :
  5093. (D_op_cmpgeu)? 272'h20202020202020202020202020202020202020202020202020202020636d70676575 :
  5094. (D_op_initi)? 272'h2020202020202020202020202020202020202020202020202020202020696e697469 :
  5095. (D_op_trap)? 272'h20202020202020202020202020202020202020202020202020202020202074726170 :
  5096. (D_op_wrctl)? 272'h2020202020202020202020202020202020202020202020202020202020777263746c :
  5097. (D_op_cmpltu)? 272'h20202020202020202020202020202020202020202020202020202020636d706c7475 :
  5098. (D_op_add)? 272'h20202020202020202020202020202020202020202020202020202020202020616464 :
  5099. (D_op_break)? 272'h2020202020202020202020202020202020202020202020202020202020627265616b :
  5100. (D_op_hbreak)? 272'h2020202020202020202020202020202020202020202020202020202068627265616b :
  5101. (D_op_sync)? 272'h20202020202020202020202020202020202020202020202020202020202073796e63 :
  5102. (D_op_sub)? 272'h20202020202020202020202020202020202020202020202020202020202020737562 :
  5103. (D_op_srai)? 272'h20202020202020202020202020202020202020202020202020202020202073726169 :
  5104. (D_op_sra)? 272'h20202020202020202020202020202020202020202020202020202020202020737261 :
  5105. (D_op_intr)? 272'h202020202020202020202020202020202020202020202020202020202020696e7472 :
  5106. (D_op_nios_custom_instr_floating_point_0)? 272'h6e696f735f637573746f6d5f696e7374725f666c6f6174696e675f706f696e745f30 :
  5107. 272'h20202020202020202020202020202020202020202020202020202020202020424144;
  5108. assign F_vinst = F_valid ? F_inst : {34{8'h2d}};
  5109. assign D_vinst = D_valid ? D_inst : {34{8'h2d}};
  5110. assign R_vinst = R_valid ? D_inst : {34{8'h2d}};
  5111. assign E_vinst = E_valid ? D_inst : {34{8'h2d}};
  5112. assign W_vinst = W_valid ? D_inst : {34{8'h2d}};
  5113. //////////////// END SIMULATION-ONLY CONTENTS
  5114. //synthesis translate_on
  5115. endmodule