protect.inc

Des_32  EQU 4000h ; 32 位段
Des_16  EQU 0000h ; 16 位段
Des_G  EQU 8000h ; 段界限粒度, G=1 表示界限粒度为4K 字节


Des_DPL0  EQU   00h ; DPL = 0 00 0  0000
Des_DPL1  EQU   20h ; DPL = 1 01 0  0000
Des_DPL2  EQU   40h ; DPL = 2 10 0  0000
Des_DPL3  EQU   60h ; DPL = 3 11 0  0000

Des_DR  EQU 90h ;1001  0000  存在的 只读     数据段类型值
Des_DRW  EQU 92h ;1001  0010  存在的 可读写   数据段属性值
Des_DRWA EQU 93h ;1001  0011  存在的 可读写  已访问  数据段类型值

Des_DRWAS EQU 93h ;1001  0111  存在的 可读写  已访问  数据段类型值

Des_C  EQU 98h ;1001  1000  存在的 只执行  代码段属性值
Des_CR  EQU 9Ah ;1001  1010  存在的 可执行可读  代码段属性值
Des_CE  EQU 9Ch ;1001  1100  存在的 只执行    一致 代码段属性值
Des_CER  EQU 9Eh ;1001  1110  存在的 可执行可读一致  代码段属性值

 

Des_LDT  EQU   82h ;1000  0010  局部描述符表段类型值
Des_TaskGate EQU   85h ;1000  0101  任务门类型值
Des_386TSS EQU   89h ;1000  1001 可用 386 任务状态段类型值
Des_386CGate EQU   8Ch ;1000  1100  386 调用门类型值
Des_386IGate EQU   8Eh ;1000  1110  386 中断门类型值
Des_386TGate EQU   8Fh ;1000  1111  386 陷阱门类型值

Sel_RPL0  EQU 0 ; ┓
Sel_RPL1  EQU 1 ; ┣ RPL
Sel_RPL2  EQU 2 ; ┃
Sel_RPL3  EQU 3 ; ┛

Sel_TIG  EQU 0 ; ┓TI
Sel_TIL  EQU 4 ; ┛

PG_P  EQU 1 ; 页存在属性位
PG_RWR  EQU 0 ; R/W 属性位值, 读/执行
PG_RWW  EQU 2 ; R/W 属性位值, 读/写/执行
PG_USS  EQU 0 ; U/S 属性位值, 系统级
PG_USU  EQU 4 ; U/S 属性位值, 用户级

%macro Descriptor 3     ; 段基址, 段界限,  属性
 dw %2 & 0FFFFh    ; 段界限 1    (2 字节)
 dw %1 & 0FFFFh    ; 段基址 1    (2 字节)
 db (%1 >> 16) & 0FFh   ; 段基址 2    (1 字节)
 dw ((%2 >> 8) & 0F00h) | (%3 & 0F0FFh) ; 属性 1 + 段界限 2 + 属性 2  (2 字节)
 db (%1 >> 24) & 0FFh   ; 段基址 3    (1 字节)
%endmacro ; 共 8 字节

%macro Gate 4      ; 选择子、偏移、属性1、属性2
 dw (%2 & 0FFFFh)    ; 偏移 1    (2 字节)
 dw %1     ; 选择子    (2 字节)
 dw (%3 & 1Fh) | ((%4 << 8) & 0FF00h) ; 属性     (2 字节)
 dw ((%2 >> 16) & 0FFFFh)   ; 偏移 2    (2 字节)
%endmacro ; 共 8 字节

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
//XW_crc_p.v `pragma protect begin module DW_crc_p( data_in, crc_in, crc_ok, crc_out ); parameter integer data_width = 16; parameter integer poly_size = 16; parameter integer crc_cfg = 7; parameter integer bit_order = 3; parameter integer poly_coef0 = 4129; parameter integer poly_coef1 = 0; parameter integer poly_coef2 = 0; parameter integer poly_coef3 = 0; input [data_width-1:0] data_in; input [poly_size-1:0] crc_in; output crc_ok; output [poly_size-1:0] crc_out; `define DW_max_data_crc_1 (data_width>poly_size?data_width:poly_size) wire [poly_size-1:0] crc_in_inv; wire [poly_size-1:0] crc_reg; wire [poly_size-1:0] crc_out_inv; wire [poly_size-1:0] crc_chk_crc_in; reg [poly_size-1:0] crc_inv_alt; reg [poly_size-1:0] crc_polynomial; `include "bit_order_crc_function.inc" `include "bit_order_data_function.inc" `include "calculate_crc_w_in_function.inc" `include "calculate_crc_function.inc" `include "calculate_crc_crc_function.inc" generate //begin genvar bit_idx; reg [63:0] crc_polynomial64; reg [15:0] coef0; reg [15:0] coef1; reg [15:0] coef2; reg [15:0] coef3; assign coef0= poly_coef0; assign coef0= poly_coef1; assign coef0= poly_coef2; assign coef0= poly_coef3; assign crc_polynomial64 = {coef3, coef2, coef1, coef0}; assign crc_pollynomial = crc_polynomial64[poly_size-1:0]; case(crc_cfg/2) 0: assign crc_inv_alt = {poly_size{1'b0}}; 1: for(bit_idx = 0; bit_idx<poly_sizel bit_idx=bit_idx+1) assign crc_inv_alt[bit_idx] = (bit_idx % 2)? 1'b0:1'b1; 2: for(bit_idx=0; bit_idx<poly_size; bit_idx=bit_idx+1) assign crc_inv_alt[bit_idx] = (bit_idx % 2)?1'b1:1'b0; 3: assign crc_inv_alt = { poly_size{1'b1}}; endcase endgenerate assign crc_in_inv = bit_order_crc(crc_in) ^ crc_inv_alt; assign crc_reg = calculate_crc(bit_order_data(data_in)); assign crc_out_inv = crc_reg; assign crc_out = bit_order_crc(crc_out_inv)^ crc_inv_alt; assign crc_chk_crc_in = calculate_crc_crc(crc_reg, crc_in_inv); assign crc_ok = (crc_chk_crc_in ==0); `undef DW_max_data_crc_1 endmodule `pragma protect end can you write a testbench for this piece of CRC verilog code so that this verilog file and the testbench can be used togerther by vcs to verify the correctness of this verilog file?
06-14
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值