/******************** MODULE INFO ****************************/ /* * File name : rk.sfl * * AUTHOR : Yoshihiro Iida (3aepm001@keyaki.cc.u-tokai.ac.jp) * VERSION : 1.0 * DATE : Oct 16, 2003 * * Compiler : sfl2vl * Project : POP-11: PDP-11 compatible On Programmable chip * Functions : RK disk control protcol converter of POP-11 for UNIX simulation * * Copyright (c) Yoshihiro Iida, Tokai University, Shimizu Lab., Japan. (http://shimizu-lab.dt.u-tokai.ac.jp) This software is the property of Tokai University, Shimizu Lab., Japan. The POP-11 is free set of files; you can use it, redistribute it and/or modify it under the following terms: 1. You are not allowed to remove or modify this copyright notice and License paragraphs, even if parts of the software is used. 2. The improvements and/or extentions you make SHALL be available for the community under THIS license, source code included. Improvements or extentions, including adaptions to new architectures/languages, SHALL be reported and transmitted to Tokai University, Shimizu Lab., Japan. 3. You must cause the modified files to carry prominent notices stating that you changed the files, what you did and the date of changes. 4. You may NOT distribute this set of files under another license without explisit permission from Tokai University, Shimizu Lab., Japan. 5. This set of files is free, and distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. You SHALL NOT use this software unless you accept to carry all risk and cost of defects or limitations. * * ------------ CHANGE RECORD ---------------- * Yoshihiro Iida (3aepm001@keyaki.cc.u-tokai.ac.jp) Sep 21, 2004: * First free version of this software published. * */ %i "inc16.sfl" %i "inc21.sfl" declare rk { instrin rkda_rd; instrin rkda_wt; instrin rkba_rd; instrin rkba_wt; instrin rkwc_rd; instrin rkwc_wt; instrin rkcs_rd; instrin rkcs_wt; input rk_in<16>; output rk_out<16>; instrin disk_ack; instrout disk_read; instrout disk_write; output disk_adr<21>; output disk_out<16>; input disk_in<16>; instrin mem_ack; instrout mem_read; instrout mem_write; output mem_adr<18>; output mem_out<16>; input mem_in<16>; instrout irq; instrout active; instr_arg rkda_wt(rk_in); instr_arg rkba_wt(rk_in); instr_arg rkwc_wt(rk_in); instr_arg rkcs_wt(rk_in); } module rk { instrin rkda_rd; instrin rkda_wt; instrin rkba_rd; instrin rkba_wt; instrin rkwc_rd; instrin rkwc_wt; instrin rkcs_rd; instrin rkcs_wt; input rk_in<16>; output rk_out<16>; instrin disk_ack; instrout disk_read; instrout disk_write; output disk_adr<21>; output disk_out<16>; input disk_in<16>; instrin mem_ack; instrout mem_read; instrout mem_write; output mem_adr<18>; output mem_out<16>; input mem_in<16>; instrout irq; instrout active; inc16 rk_inc; inc21 rk_inc2; reg_wr RKDA<13>; reg_wr RKBA<16>; reg_wr RKWC<16>; reg_wr RKCS<9>; reg_wr RKBC<21>; reg_wr rk_buf<16>; reg_wr end_flag; instr_arg disk_read(disk_adr); instr_arg disk_write(disk_adr,disk_out); instr_arg mem_read(mem_adr); instr_arg mem_write(mem_adr,mem_out); stage_name main { task run(); } %d CS_ERR RKCS<8> %d CS_RDY RKCS<7> %d CS_INT RKCS<6> %d CS_XMEM RKCS<5:4> %d CS_COM RKCS<3:1> %d CS_SW RKCS<0> par { generate main.run(); } instruct rkda_rd rk_out = 0o0||RKDA; instruct rkba_rd rk_out = RKBA; instruct rkwc_rd rk_out = RKWC; instruct rkcs_rd rk_out = CS_ERR||(7#0b0)||CS_RDY||CS_INT||CS_XMEM||CS_COM||CS_SW; instruct rkda_wt RKDA := rk_in<12:00>; instruct rkba_wt RKBA := rk_in; instruct rkwc_wt RKWC := rk_in<15:8>||0x00; instruct rkcs_wt RKCS := rk_in<15>||rk_in<7:0>; stage main { state_name ready, read0, read1, write0, write1, fin; first_state ready; state ready par { if(CS_SW) RKBC := RKDA||0x00; if(CS_SW) any { CS_COM==0b001: goto write0; CS_COM==0b010: goto read0; } } state read0 par { disk_read(RKBC); if(disk_ack) par { RKWC := rk_inc.do(RKWC).out; RKBC := rk_inc2.do(RKBC).out; if(^/|rk_inc.out) end_flag := 0b1; rk_buf := disk_in; goto read1; } } state read1 par { active(); mem_write(CS_XMEM||RKBA, rk_buf); rk_inc2.do(0x0||CS_XMEM||RKBA<15:01>); RKBA := rk_inc2.out<14:0>||0b0; RKCS := RKCS<8:6>||rk_inc2.out<16:15>||RKCS<3:0>; if(^end_flag) goto read0; if( end_flag) goto fin; } state write0 par { active(); mem_read(CS_XMEM||RKBA); if(mem_ack) par { rk_buf := mem_in; RKWC := rk_inc.do(RKWC).out; rk_inc2.do(0x0||CS_XMEM||RKBA<15:01>); RKBA := rk_inc2.out<14:0>||0b0; RKCS := RKCS<8:6>||rk_inc2.out<16:15>||RKCS<3:0>; if(^/|rk_inc.out) end_flag := 0b1; goto write1; } } state write1 par { disk_write(RKBC, rk_buf); if(disk_ack) par { RKBC := rk_inc2.do(RKBC).out; if(^end_flag) goto write0; if( end_flag) goto fin; } } state fin par { RKCS := 0b0||0b1||CS_INT||CS_XMEM||0b000||0b0; if(CS_INT) irq(); end_flag := 0b0; goto ready; } } }/* end_flag of rk */