URL
https://opencores.org/ocsvn/ao486/ao486/trunk
Subversion Repositories ao486
[/] [ao486/] [trunk/] [rtl/] [ao486/] [commands/] [CMD_LAR_LSL_VERR_VERW.txt] - Rev 2
Compare with Previous | Blame | View Log
<defines>
`define CMD_LAR #AUTOGEN_NEXT_CMD
`define CMD_LSL #AUTOGEN_NEXT_CMD
`define CMD_VERR #AUTOGEN_NEXT_CMD
`define CMD_VERW #AUTOGEN_NEXT_CMD
`define CMDEX_LAR_LSL_VERR_VERW_STEP_1 4'd0
`define CMDEX_LAR_LSL_VERR_VERW_STEP_2 4'd1
// glob_param_1[15:0] --> selector
// glob_param_2[x:0] --> selector and descriptor check bits
`define CMDEX_LAR_LSL_VERR_VERW_STEP_LAST 4'd2
</defines>
<decode>
dec_ready_2byte_modregrm && decoder[7:0] == 8'h00 && decoder[13:11] == 3'd4
prefix_group_1_lock || ~(protected_mode)
`CMD_VERR
SET(dec_cmdex, `CMDEX_LAR_LSL_VERR_VERW_STEP_1);
SET(consume_modregrm_one);
SET(dec_is_complex);
</decode>
<decode>
dec_ready_2byte_modregrm && decoder[7:0] == 8'h00 && decoder[13:11] == 3'd5
prefix_group_1_lock || ~(protected_mode)
`CMD_VERW
SET(dec_cmdex, `CMDEX_LAR_LSL_VERR_VERW_STEP_1);
SET(consume_modregrm_one);
SET(dec_is_complex);
</decode>
<decode>
dec_ready_2byte_modregrm && decoder[7:0] == 8'h02
prefix_group_1_lock || ~(protected_mode)
`CMD_LAR
SET(dec_cmdex,`CMDEX_LAR_LSL_VERR_VERW_STEP_1);
SET(consume_modregrm_one);
SET(dec_is_complex);
</decode>
<decode>
dec_ready_2byte_modregrm && decoder[7:0] == 8'h03
prefix_group_1_lock || ~(protected_mode)
`CMD_LSL
SET(dec_cmdex, `CMDEX_LAR_LSL_VERR_VERW_STEP_1);
SET(consume_modregrm_one);
SET(dec_is_complex);
</decode>
<microcode>
IF((mc_cmd == `CMD_LAR || mc_cmd == `CMD_LSL || mc_cmd == `CMD_VERR || mc_cmd == `CMD_VERW) && mc_cmdex_last == `CMDEX_LAR_LSL_VERR_VERW_STEP_1);
DIRECT(mc_cmd, `CMDEX_LAR_LSL_VERR_VERW_STEP_2);
ENDIF();
IF((mc_cmd == `CMD_LAR || mc_cmd == `CMD_LSL || mc_cmd == `CMD_VERR || mc_cmd == `CMD_VERW) && mc_cmdex_last == `CMDEX_LAR_LSL_VERR_VERW_STEP_2);
LAST_DIRECT(mc_cmd, `CMDEX_LAR_LSL_VERR_VERW_STEP_LAST);
ENDIF();
</microcode>
<read>
IF((rd_cmd == `CMD_LAR || rd_cmd == `CMD_LSL || rd_cmd == `CMD_VERR || rd_cmd == `CMD_VERW) && rd_cmdex == `CMDEX_LAR_LSL_VERR_VERW_STEP_1);
// src: rm
IF(rd_modregrm_mod == 2'b11);
IF(rd_mutex_busy_modregrm_rm); SET(rd_waiting);
ELSE();
SET(rd_dst_is_rm);
SET(rd_glob_param_1_set);
SET(rd_glob_param_1_value, { 16'd0, dst_wire[15:0] });
ENDIF();
ENDIF();
// src: memory
IF(rd_modregrm_mod != 2'b11);
SET(read_length_word);
IF(rd_mutex_busy_memory); SET(rd_waiting);
ELSE();
SET(rd_glob_param_1_set);
SET(rd_glob_param_1_value, { 16'd0, read_4[15:0] });
SET(read_virtual);
IF(~(read_for_rd_ready)); SET(rd_waiting); ENDIF();
ENDIF();
ENDIF();
ENDIF();
</read>
<read>
IF((rd_cmd == `CMD_LAR || rd_cmd == `CMD_LSL || rd_cmd == `CMD_VERR || rd_cmd == `CMD_VERW) && rd_cmdex == `CMDEX_LAR_LSL_VERR_VERW_STEP_2);
IF(~(glob_param_1[15:2] == 14'd0) && ~(rd_descriptor_not_in_limits)); // load null; not in limits
SET(read_length_word);
IF(rd_mutex_busy_memory); SET(rd_waiting);
ELSE();
SET(rd_glob_descriptor_set);
SET(rd_glob_descriptor_value, read_8);
SET(rd_glob_param_2_set);
SET(rd_glob_param_2_value, 32'd0);
SET(read_system_descriptor);
IF(~(read_for_rd_ready)); SET(rd_waiting); ENDIF();
ENDIF();
ELSE();
SET(rd_glob_param_2_set);
SET(rd_glob_param_2_value, { 30'd0, rd_descriptor_not_in_limits, glob_param_1[15:2] == 14'd0 });
ENDIF();
ENDIF();
</read>
<read>
IF((rd_cmd == `CMD_LAR || rd_cmd == `CMD_LSL) && rd_cmdex == `CMDEX_LAR_LSL_VERR_VERW_STEP_LAST);
SET(rd_req_eflags);
IF(rd_cmd == `CMD_LAR); SET(rd_extra_wire, { 8'd0, glob_descriptor[55:40], 8'd0 });
ELSE(); SET(rd_extra_wire, glob_desc_limit);
ENDIF();
IF(exe_mutex[`MUTEX_ACTIVE_BIT]); SET(rd_waiting); // wait for descriptor check in exe stage
ELSE();
IF(glob_param_2[1:0] == 2'd0 && ((glob_param_2[2] == 1'd0 && rd_cmd == `CMD_LAR) || (glob_param_2[3] == 1'd0 && rd_cmd == `CMD_LSL)));
SET(rd_dst_is_reg);
SET(rd_req_reg);
ENDIF();
ENDIF();
ENDIF();
</read>
<read>
IF((rd_cmd == `CMD_VERR || rd_cmd == `CMD_VERW) && rd_cmdex == `CMDEX_LAR_LSL_VERR_VERW_STEP_LAST);
SET(rd_req_eflags);
IF(exe_mutex[`MUTEX_ACTIVE_BIT]); SET(rd_waiting); // wait for descriptor check in exe stage
ELSE();
IF(glob_param_2[1:0] == 2'd0 && ((glob_param_2[4] == 1'd0 && rd_cmd == `CMD_VERR) || (glob_param_2[5] == 1'd0 && rd_cmd == `CMD_VERW)));
SET(rd_dst_is_reg); // only to signal
ENDIF();
ENDIF();
ENDIF();
</read>
<execute_local>
wire exe_cmd_lar_desc_invalid;
wire exe_cmd_lsl_desc_invalid;
wire exe_cmd_verr_desc_invalid;
wire exe_cmd_verw_desc_invalid;
assign exe_cmd_lar_desc_invalid =
// descriptor type not valid
(~(exe_descriptor[`DESC_BIT_SEG]) &&
(exe_descriptor[`DESC_BITS_TYPE] == 4'd0 || exe_descriptor[`DESC_BITS_TYPE] == 4'd8 ||
exe_descriptor[`DESC_BITS_TYPE] == 4'd10 || exe_descriptor[`DESC_BITS_TYPE] == 4'd13)
) ||
// segment descriptor
(exe_descriptor[`DESC_BIT_SEG] && (`DESC_IS_DATA(exe_descriptor) || `DESC_IS_CODE_NON_CONFORMING(exe_descriptor)) && exe_privilege_not_accepted
) ||
// descriptor system descriptor type not valid
(~(exe_descriptor[`DESC_BIT_SEG]) &&
(exe_descriptor[`DESC_BITS_TYPE] == `DESC_INTERRUPT_GATE_386 || exe_descriptor[`DESC_BITS_TYPE] == `DESC_INTERRUPT_GATE_286 ||
exe_descriptor[`DESC_BITS_TYPE] == `DESC_TRAP_GATE_386 || exe_descriptor[`DESC_BITS_TYPE] == `DESC_TRAP_GATE_286)
) ||
// system descriptor privilege
(~(exe_descriptor[`DESC_BIT_SEG]) && exe_privilege_not_accepted
);
assign exe_cmd_lsl_desc_invalid =
// descriptor type not valid
(~(exe_descriptor[`DESC_BIT_SEG]) &&
(exe_descriptor[`DESC_BITS_TYPE] != `DESC_TSS_AVAIL_386 && exe_descriptor[`DESC_BITS_TYPE] != `DESC_TSS_BUSY_386 &&
exe_descriptor[`DESC_BITS_TYPE] != `DESC_TSS_AVAIL_286 && exe_descriptor[`DESC_BITS_TYPE] != `DESC_TSS_BUSY_286 &&
exe_descriptor[`DESC_BITS_TYPE] != `DESC_LDT)
) ||
// system descriptor privilege
(~(exe_descriptor[`DESC_BIT_SEG]) && exe_privilege_not_accepted
) ||
// segment descriptor
(exe_descriptor[`DESC_BIT_SEG] && (`DESC_IS_DATA(exe_descriptor) || `DESC_IS_CODE_NON_CONFORMING(exe_descriptor)) && exe_privilege_not_accepted
);
assign exe_cmd_verr_desc_invalid =
// system descriptor
(~(exe_descriptor[`DESC_BIT_SEG])
) ||
// code segment
(`DESC_IS_CODE_EO(exe_descriptor) || (`DESC_IS_CODE_NON_CONFORMING(exe_descriptor) && exe_privilege_not_accepted)
) ||
// data segment
(`DESC_IS_DATA(exe_descriptor) && exe_privilege_not_accepted
);
assign exe_cmd_verw_desc_invalid =
// system descriptor
(~(exe_descriptor[`DESC_BIT_SEG])
) ||
// code segment
(`DESC_IS_CODE(exe_descriptor)
) ||
// data segment
(`DESC_IS_DATA_RO(exe_descriptor) || exe_privilege_not_accepted
);
</execute_local>
<execute>
IF((exe_cmd == `CMD_LAR || exe_cmd == `CMD_LSL) && exe_cmdex == `CMDEX_LAR_LSL_VERR_VERW_STEP_LAST);
SET(exe_result, exe_extra);
ENDIF();
</execute>
<execute>
IF((exe_cmd == `CMD_LAR || exe_cmd == `CMD_LSL || exe_cmd == `CMD_VERR || exe_cmd == `CMD_VERW) && exe_cmdex == `CMDEX_LAR_LSL_VERR_VERW_STEP_2);
SET(exe_glob_param_2_set);
SET(exe_glob_param_2_value, { 26'd0, exe_cmd_verw_desc_invalid, exe_cmd_verr_desc_invalid, exe_cmd_lsl_desc_invalid, exe_cmd_lar_desc_invalid, glob_param_2[1:0] });
ENDIF();
</execute>
<write>
IF((wr_cmd == `CMD_LAR || wr_cmd == `CMD_LSL || wr_cmd == `CMD_VERR || wr_cmd == `CMD_VERW) && (wr_cmdex == `CMDEX_LAR_LSL_VERR_VERW_STEP_1 || wr_cmdex == `CMDEX_LAR_LSL_VERR_VERW_STEP_2));
SET(wr_not_finished);
ENDIF();
</write>
<write>
IF((wr_cmd == `CMD_LAR || wr_cmd == `CMD_LSL) && wr_cmdex == `CMDEX_LAR_LSL_VERR_VERW_STEP_LAST);
IF(wr_dst_is_reg);
SAVE(zflag, `TRUE);
SET(write_regrm);
ELSE();
SAVE(zflag, `FALSE);
ENDIF();
ENDIF();
</write>
<write>
IF((wr_cmd == `CMD_VERR || wr_cmd == `CMD_VERW) && wr_cmdex == `CMDEX_LAR_LSL_VERR_VERW_STEP_LAST);
SAVE(zflag, wr_dst_is_reg);
ENDIF();
</write>