ls_test.rmh
来自「和picoblaze完全兼容的mcu ip core」· RMH 代码 · 共 1,595 行 · 第 1/5 页
RMH
1,595 行
// #99: ;// #100: CONSTANT(line_store6_output_L,21) ;Line Store output bits [7:0]// #101: CONSTANT(line_store6_output_H,22) ;Line Store output bit [8]// #102: ;// #103: ;// #104: ;The seventh line store is 1920x48 so to make it more manageable it has been// #105: ;folded to make it 2 times longer and only 24-bits wide. This requires 3 bytes// #106: ;to be read at each 1920 delay tapping point.// #107: ;// #108: CONSTANT(line_store7a_output_L,23) ;Line Store output bits [7:0] First tap// #109: CONSTANT(line_store7a_output_M,24) ;Line Store output bits [15:8]// #110: CONSTANT(line_store7a_output_H,25) ;Line Store output bits [23:16]// #111: ;// #112: CONSTANT(line_store7b_output_L,26) ;Line Store output bits [31:24] Second tap// #113: CONSTANT(line_store7b_output_M,27) ;Line Store output bits [39:32]// #114: CONSTANT(line_store7b_output_H,28) ;Line Store output bits [47:40]// #115: ;// #116: ;// #117: ;**************************************************************************************// #118: ; Special Register usage// #119: ;**************************************************************************************// #120: ;// #121: NAMEREG(sF,UART_data) ;used to pass data to and from the UART// #122: ;// #123: ;// #124: ;// #125: ;**************************************************************************************// #126: ;Scratch Pad Memory Locations// #127: ;**************************************************************************************// #128: ;// #129: CONSTANT(step_counter0,0) ;decimal count of line store write operations// #130: CONSTANT(step_counter1,1)// #131: CONSTANT(step_counter2,2)// #132: CONSTANT(step_counter3,3)// #133: CONSTANT(step_counter4,4)// #134: ;// #135: CONSTANT(test_data_in0,5) ;24-bit data applied to line store input// #136: CONSTANT(test_data_in1,6)// #137: CONSTANT(test_data_in2,7)// #138: ;// #139: CONSTANT(n_count0,8) ;decimal count cycles to count in command// #140: CONSTANT(n_count1,9)// #141: CONSTANT(n_count2,10)// #142: CONSTANT(n_count3,11)// #143: ;// #144: ;// #145: CONSTANT(auto_inc,12) ;Determines if auto increment is active// #146: ;// #147: CONSTANT(fast_mode,13) ;Determines if fast mode is active// #148: ;// #149: ;UART character strings will be stored in scratch pad memory ending in carriage return.// #150: ;A string can be up to 16 characters with the start location defined by this constant.// #151: ;// #152: CONSTANT(string_start,48)// #153: ;// #154: ;// #155: ;// #156: ;**************************************************************************************// #157: ;Useful data constants// #158: ;**************************************************************************************// #159: ;// #160: ;// #161: ;// #162: ;// #163: ;ASCII table// #164: ;// #165: CONSTANT(character_a,97)// #166: CONSTANT(character_b,98)// #167: CONSTANT(character_c,99)// #168: CONSTANT(character_d,100)// #169: CONSTANT(character_e,101)// #170: CONSTANT(character_f,102)// #171: CONSTANT(character_g,103)// #172: CONSTANT(character_h,104)// #173: CONSTANT(character_i,105)// #174: CONSTANT(character_j,106)// #175: CONSTANT(character_k,107)// #176: CONSTANT(character_l,108)// #177: CONSTANT(character_m,109)// #178: CONSTANT(character_n,110)// #179: CONSTANT(character_o,111)// #180: CONSTANT(character_p,112)// #181: CONSTANT(character_q,113)// #182: CONSTANT(character_r,114)// #183: CONSTANT(character_s,115)// #184: CONSTANT(character_t,116)// #185: CONSTANT(character_u,117)// #186: CONSTANT(character_v,118)// #187: CONSTANT(character_w,119)// #188: CONSTANT(character_x,120)// #189: CONSTANT(character_y,121)// #190: CONSTANT(character_z,122)// #191: CONSTANT(character_A,65)// #192: CONSTANT(character_B,66)// #193: CONSTANT(character_C,67)// #194: CONSTANT(character_D,68)// #195: CONSTANT(character_E,69)// #196: CONSTANT(character_F,70)// #197: CONSTANT(character_G,71)// #198: CONSTANT(character_H,72)// #199: CONSTANT(character_I,73)// #200: CONSTANT(character_J,74)// #201: CONSTANT(character_K,75)// #202: CONSTANT(character_L,76)// #203: CONSTANT(character_M,77)// #204: CONSTANT(character_N,78)// #205: CONSTANT(character_O,79)// #206: CONSTANT(character_P,80)// #207: CONSTANT(character_Q,81)// #208: CONSTANT(character_R,82)// #209: CONSTANT(character_S,83)// #210: CONSTANT(character_T,84)// #211: CONSTANT(character_U,85)// #212: CONSTANT(character_V,86)// #213: CONSTANT(character_W,87)// #214: CONSTANT(character_X,88)// #215: CONSTANT(character_Y,89)// #216: CONSTANT(character_Z,90)// #217: CONSTANT(character_0,48)// #218: CONSTANT(character_1,49)// #219: CONSTANT(character_2,50)// #220: CONSTANT(character_3,51)// #221: CONSTANT(character_4,52)// #222: CONSTANT(character_5,53)// #223: CONSTANT(character_6,54)// #224: CONSTANT(character_7,55)// #225: CONSTANT(character_8,56)// #226: CONSTANT(character_9,57)// #227: CONSTANT(character_colon,58)// #228: CONSTANT(character_stop,46)// #229: CONSTANT(character_semi_colon,59)// #230: CONSTANT(character_minus,45)// #231: CONSTANT(character_divide,47) ;'/'// #232: CONSTANT(character_plus,43)// #233: CONSTANT(character_comma,44)// #234: CONSTANT(character_less_than,60)// #235: CONSTANT(character_greater_than,62)// #236: CONSTANT(character_equals,61)// #237: CONSTANT(character_space,32)// #238: CONSTANT(character_CR,13) ;carriage return// #239: CONSTANT(character_question,63) ;'?'// #240: CONSTANT(character_dollar,36)// #241: CONSTANT(character_exclaim,33) ;'!'// #242: CONSTANT(character_BS,8) ;Back Space command character// #243: ;// #244: ;// #245: ;// #246: ;// #247: ;// #248: ;**************************************************************************************// #249: ;Initialise the system// #250: ;**************************************************************************************// #251: ;// #252: ;// @000 #253: [cold_start]00001 // @000 #253: LOAD(s0,LED0)2c080 // @001 #254: OUTPUT(s0,LED_port)// #255: ;30226 // @002 #256: CALL(send_welcome) ;Write welcome message to UART// #257: ;00000 // @003 #258: LOAD(s0,0) ;clear counter2e004 // @004 #259: STORE(s0,step_counter4)2e003 // @005 #260: STORE(s0,step_counter3)2e002 // @006 #261: STORE(s0,step_counter2)2e001 // @007 #262: STORE(s0,step_counter1)2e000 // @008 #263: STORE(s0,step_counter0)// #264: ;2c001 // @009 #265: OUTPUT(s0,line_store_input_L) ;Clear input to line store2c002 // @00a #266: OUTPUT(s0,line_store_input_M)2c004 // @00b #267: OUTPUT(s0,line_store_input_H)2e005 // @00c #268: STORE(s0,test_data_in0)2e006 // @00d #269: STORE(s0,test_data_in1)2e007 // @00e #270: STORE(s0,test_data_in2)// #271: ;// #272: ;0020f // @00f #273: LOAD(s2,15) ;purge line stores with 4000 writes of zero001a0 // @010 #274: LOAD(s1,A0)// @011 #275: [purge_loop]2c008 // @011 #275: OUTPUT(s0,line_store_write_en) ;dummy write to enable line store1c101 // @012 #276: SUB(s1,1)35c11 // @013 #277: JUMP(NC,purge_loop)1c201 // @014 #278: SUB(s2,1)35c11 // @015 #279: JUMP(NC,purge_loop)// #280: ;// #281: ;2e00d // @016 #282: STORE(s0,fast_mode) ;turn off fast mode by default// #283: ;00001 // @017 #284: LOAD(s0,1) ;default first value is 000001 hex2c001 // @018 #285: OUTPUT(s0,line_store_input_L)2e005 // @019 #286: STORE(s0,test_data_in0)// #287: ;2e00c // @01a #288: STORE(s0,auto_inc) ;turn auto increment on by default// #289: ;// #290: ;**************************************************************************************// #291: ; Main program// #292: ;**************************************************************************************// #293: ;// #294: ; Provides a prompt to which an input with one of the following formats is expected...// #295: ;// #296: ; set hhhhhh - Set value to be written into line store.// #297: ; 'hhhhhh' is a 6 digit hex value.// #298: ;// #299: ; cycle n - drive line store with 'n' cycles and display results.// #300: ; 'n' is a decimal number up to 9999.// #301: ;// #302: ; reset - Clears the counter and also purges all line store of all values.// #303: ;// #304: ; auto on - Turns on the auto increment of the set value so that each// #305: ; seccessive write of data will be different and useful for// #306: ; determining the delay length.// #307: ;// #308: ; auto off - Turns off the auto increment function so that all successive writes// #309: ; to the line stores will be identical.// #310: ;// #311: ;// #312: ; fast on - Turns on the fast execute mode in which the output to the// #313: ; display via the UART is turned off during multi-cycle operations.// #314: ; This results in much greater speed.// #315: ;// #316: ; fast off - Turns off fast execution mode allowing all data to be displayed.// #317: ;// #318: ; The input allows a degree of editing to be performed and upper and lower case letters// #319: ; to be used.// #320: ;// @01b #321: [warm_start]0600c // @01b #321: FETCH(s0,auto_inc) ;use LED0 to display state of auto increment0610d // @01c #322: FETCH(s1,fast_mode) ;use LED1 to display state of fast mode14100 // @01d #323: COMPARE(s1,0)35020 // @01e #324: JUMP(Z,set_LEDs)0c002 // @01f #325: OR(s0,LED1)// @020 #326: [set_LEDs]2c080 // @020 #326: OUTPUT(s0,LED_port)// #327: ;3025e // @021 #328: CALL(send_prompt) ;Prompt 'KCPSM3>'301b1 // @022 #329: CALL(receive_string) ;obtain input string of up to 16 characters301d9 // @023 #330: CALL(upper_case_string) ;convert string to upper case// #331: ;00e30 // @024 #332: LOAD(sE,string_start) ;sE is memory pointer070e0 // @025 #333: FETCH(s0,sE) ;test for carriage return1400d // @026 #334: COMPARE(s0,character_CR)3501b // @027 #335: JUMP(Z,warm_start)14053 // @028 #336: COMPARE(s0,character_S) ;test for 'S' of 'SET' command35045 // @029 #337: JUMP(Z,SET_command)14043 // @02a #338: COMPARE(s0,character_C) ;test for 'C' of 'CYCLE' command350b4 // @02b #339: JUMP(Z,CYCLE_command)14052 // @02c #340: COMPARE(s0,character_R) ;test for 'R' of 'RESET' command35035 // @02d #341: JUMP(Z,RESET_command)14041 // @02e #342: COMPARE(s0,character_A) ;test for 'A' of 'AUTO' command3506e // @02f #343: JUMP(Z,AUTO_command)14046 // @030 #344: COMPARE(s0,character_F) ;test for 'F' of 'FAST' command35091 // @031 #345: JUMP(Z,FAST_command)// @032 #346: [bad_command]3021d // @032 #346: CALL(send_CR) ;no valid command entered3027f // @033 #347: CALL(send_Error)3401b // @034 #348: JUMP(warm_start)// #349: ;// #350: ;Processing potential 'RESET' command// #351: ;// @035 #352: [RESET_command]30112 // @035 #352: CALL(read_next_char) ;test for 'E' of 'RESET' command14045 // @036 #353: COMPARE(s0,character_E)35432 // @037 #354: JUMP(NZ,bad_command)30112 // @038 #355: CALL(read_next_char) ;test for 'S' of 'RESET' command14053 // @039 #356: COMPARE(s0,character_S)35432 // @03a #357: JUMP(NZ,bad_command)30112 // @03b #358: CALL(read_next_char) ;test for 'E' of 'RESET' command14045 // @03c #359: COMPARE(s0,character_E)35432 // @03d #360: JUMP(NZ,bad_command)30112 // @03e #361: CALL(read_next_char) ;test for 'T' of 'RESET' command14054 // @03f #362: COMPARE(s0,character_T)35432 // @040 #363: JUMP(NZ,bad_command)30112 // @041 #364: CALL(read_next_char) ;test for a carriage return1400d // @042 #365: COMPARE(s0,character_CR)35432 // @043 #366: JUMP(NZ,bad_command)34000 // @044 #367: JUMP(cold_start)// #368: ;// #369: ;Processing potential 'SET' command// #370: ;// @045 #371: [SET_command]30112 // @045 #371: CALL(read_next_char) ;test for 'E' of 'SET' command14045 // @046 #372: COMPARE(s0,character_E)35432 // @047 #373: JUMP(NZ,bad_command)30112 // @048 #374: CALL(read_next_char) ;test for 'T' of 'SET' command14054 // @049 #375: COMPARE(s0,character_T)35432 // @04a #376: JUMP(NZ,bad_command)30112 // @04b #377: CALL(read_next_char) ;test for a space14020 // @04c #378: COMPARE(s0,character_space)35432 // @04d #379: JUMP(NZ,bad_command)// #380: ;read value into register set [sC,sB,sA]30112 // @04e #381: CALL(read_next_char) ;read two character hex value01300 // @04f #382: LOAD(s3,s0)30112 // @050 #383: CALL(read_next_char)01200 // @051 #384: LOAD(s2,s0)301e5 // @052 #385: CALL(ASCII_byte_to_hex) ;convert to value in s035832 // @053 #386: JUMP(C,bad_command)01c00 // @054 #387: LOAD(sC,s0) ;remember value30112 // @055 #388: CALL(read_next_char) ;read two character hex value01300 // @056 #389: LOAD(s3,s0)30112 // @057 #390: CALL(read_next_char)01200 // @058 #391: LOAD(s2,s0)301e5 // @059 #392: CALL(ASCII_byte_to_hex) ;convert to value in s035832 // @05a #393: JUMP(C,bad_command)01b00 // @05b #394: LOAD(sB,s0) ;remember value30112 // @05c #395: CALL(read_next_char) ;read two character hex value01300 // @05d #396: LOAD(s3,s0)30112 // @05e #397: CALL(read_next_char)01200 // @05f #398: LOAD(s2,s0)301e5 // @060 #399: CALL(ASCII_byte_to_hex) ;convert to value in s035832 // @061 #400: JUMP(C,bad_command)01a00 // @062 #401: LOAD(sA,s0) ;remember value30112 // @063 #402: CALL(read_next_char) ;test for carriage return to end command1400d // @064 #403: COMPARE(s0,character_CR)35432 // @065 #404: JUMP(NZ,bad_command)2ea05 // @066 #405: STORE(sA,test_data_in0) ;store new line store input value2eb06 // @067 #406: STORE(sB,test_data_in1)2ec07 // @068 #407: STORE(sC,test_data_in2)2ca01 // @069 #408: OUTPUT(sA,line_store_input_L) ;Write data to register driving line store2cb02 // @06a #409: OUTPUT(sB,line_store_input_M)2cc04 // @06b #410: OUTPUT(sC,line_store_input_H)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?