⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 a86_cond_sel.v

📁 使用CPLD仿真8088核,内有源程序和说明
💻 V
字号:
// http://gforge.openchip.org/projects/a86

//
// Select Condition code for conditional commands
//

`include "timescale.v"
`include "a86_defines.v"

module a86_cond_sel(
  sel,
  fin,
  cin,
  cx_zero,
  cout,
  icode
 );

input [`a86_icode_width-1:0] icode;
input [4:0] sel;
input [15:0] fin;
input cin;
input cx_zero;
output cout;

reg cout;


// stupid todo it so here?
always @ (icode)
  case (icode[`a86_icode_i_start+7:`a86_icode_i_start])
    8'b01110000: cout = fin[`psf_of];   // JO
    8'b01110001: cout = ~fin[`psf_of];  // JNO
    8'b01110010: cout = fin[`psf_cf];   // JC
    8'b01110011: cout = ~fin[`psf_cf];  // JNC
    8'b01110100: cout = fin[`psf_zf];   // JZ
    8'b01110101: cout = ~fin[`psf_zf];  // JNZ
    8'b01110110: cout = fin[`psf_cf] | ~fin[`psf_zf];   // JBE
    8'b01110111: cout = (~fin[`psf_cf]) & (~fin[`psf_zf]);  // JNBE
    8'b01111000: cout = fin[`psf_sf];   // JS
    8'b01111001: cout = ~fin[`psf_sf];  // JNS
    8'b01111010: cout = fin[`psf_pf];   // JPO
    8'b01111011: cout = ~fin[`psf_pf];  // JPE
    8'b01111100: cout = fin[`psf_sf] ^ fin[`psf_of];   // JL
    8'b01111101: cout = ~(fin[`psf_sf] ^ fin[`psf_of]);  // JNL
    8'b01111110: cout = fin[`psf_zf] | (fin[`psf_sf] ^ fin[`psf_of]);   // JLE
    8'b01111111: cout = (~fin[`psf_zf]) & ( ~(fin[`psf_sf] ^ fin[`psf_of]) );   // JNLE

    8'b11101011: cout = 1'b1;     // JMP rel8 
    8'b11100000: cout = ~cx_zero & ~fin[`psf_zf]; // LOOPNE
    8'b11100001: cout = ~cx_zero & fin[`psf_zf]; // LOOPE
    8'b11100010: cout = ~cx_zero; // LOOP
    8'b11100011: cout = cx_zero;  // JCXZ

    default: cout = cin; // if not decoded use in condition?
  endcase
 

endmodule

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -