Board logo

标题: Atlys开发板FPGA Design Flow LAB4的KPSM3程序--参加年度达人 [打印本页]

作者: pengpengpang    时间: 2014-2-28 09:19     标题: Atlys开发板FPGA Design Flow LAB4的KPSM3程序--参加年度达人

这个程序的主要目的是执行一个回送测试(loop back test),然后将“Xilinx Rules”这个字符串显示在PC上的超级终端上。
因为只能8位8位的发,所以需要写好多次。
首先是端口定义:
CONSTANT switch_in        , 00    ; Switch read port
CONSTANT leds_out         , 01    ; LED write port
CONSTANT uart_data_rx     , 02    ; UART receive read port
CONSTANT uart_data_tx     , 03    ; UART transmit write port
CONSTANT data_present     , 04    ; UART stat read port, lsb
CONSTANT buffer_full      , 05    ; UART stat read port, lsb

其次是将对应的asiii码写入端口(58696C586E782052756C6573)
cold_start:     LOAD     s0, all_clear     ; zero out reg s0
                LOAD     s1, ascii_X       ;
                OUTPUT   s1, uart_data_tx  ;
                LOAD     s1, ascii_i       ;
                OUTPUT   s1, uart_data_tx  ;
                LOAD     s1, ascii_l       ;
                OUTPUT   s1, uart_data_tx  ;
                LOAD     s1, ascii_i       ;
                OUTPUT   s1, uart_data_tx  ;
                LOAD     s1, ascii_n       ;
                OUTPUT   s1, uart_data_tx  ;
                LOAD     s1, ascii_x       ;
                OUTPUT   s1, uart_data_tx  ;
                LOAD     s1, ascii_SPACE   ;
                OUTPUT   s1, uart_data_tx  ;
                LOAD     s1, ascii_R       ;
                OUTPUT   s1, uart_data_tx  ;
                LOAD     s1, ascii_u       ;
                OUTPUT   s1, uart_data_tx  ;
                LOAD     s1, ascii_l       ;
                OUTPUT   s1, uart_data_tx  ;
                LOAD     s1, ascii_e       ;
                OUTPUT   s1, uart_data_tx  ;
                LOAD     s1, ascii_s       ;
                OUTPUT   s1, uart_data_tx  ;
                LOAD     s1, ascii_EXCLAIM ;
                OUTPUT   s1, uart_data_tx  ;
                LOAD     s1, ascii_CR      ;
                OUTPUT   s1, uart_data_tx  ;
                LOAD     s1, ascii_LF      ;
                OUTPUT   s1, uart_data_tx  ;
补充:因为program.psm开头预定义了端口地址,所以这里直接用它的名字就行了,上次做的那个程序有点麻烦了,可以改成

loop:           INPUT    s1, switch_in     ; read switch state
                OUTPUT   s1, leds_out    ; write it to leds





欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0