always @ (posedge Peri_clk or posedge RESET)
begin
if(RESET)
begin
outdb<=8’hz; SPICCR<=8’h00; SPICTL<=8’h00; SPIBBR<=8’h00; SPIPRI<=8’h00;
end
end
always @(posedge Peri_clk or posedge RESET)
begin
if(RESET)
shift_out_d<=1’b0;
else
case(1’b1)
spidat_w: SPIDAT<=PeriDB; shifi_out_clk:shift_out_d<=SPIDAT[7];
sample_in_clk:SPIDAT[7:0]<={SPIDAT[6:0],sample in_d};
default;
endcase
end
always@(posedge Peri_clk or posedge RESET)
begin
if(RESET)
SPISTS<=8’h00;
else
begin
if(SW_RESET)
SPISTS[7:6]<=2’hO;
else if(int_flag_set)
begin
SPISTS[6]<=1’b1;SPIBUF<=SPIDAT;SPIEMU<=SPIDAT;
end
else if(spibuf_r)
SPISTS[6]<=1’b0;
if(overrun_flag set)
SPISTS[7]<=1’b1;
else if(sts7_clr)
SPISTS[7]<=1’b0;
end
end