《電子技術(shù)應(yīng)用》
您所在的位置:首頁 > 嵌入式技術(shù) > 業(yè)界動態(tài) > Core_1553_8051_SFR Verilog設(shè)計文件

Core_1553_8051_SFR Verilog設(shè)計文件

2008-08-13
作者:Actel
關(guān)鍵詞: present_st B0 CPUWAITn reg sfr4

// SFR_FSM.v
module SFR_FSM (clk, Resetn, sfr4" title="sfr4">sfr4, sfr7, CPUDOUT, CPUWAITn" title="CPUWAITn">CPUWAITn, latch_RD, CPUWRn,
??????????????? CPURDn , CPUMEM);

input clk;
input [2:0] sfr4; // SFR4 Control Reg" title="Reg">Register bit 2 to 0.
input CPUWAITn; //input from Core1553
input Resetn; //global power on reset
input [15:0] CPUDOUT; // Read data input from Core1553B
output [7:0] sfr7; // SFR7 Status Regsiter
output [1:0] CPUWRn; //Output to Core1553
output CPURDn; //Output to Core1553
output [15:0] latch_RD; //read data output to Core8051
output CPUMEM; //Output to Core1553

parameter idle = 2'b0" title="b0">b00, write = 2'b01, read = 2'b10;

reg CPURDn_int, CPUMEM;
reg [1:0] CPUWRn;
reg [7:0] sfr7;
reg [15:0] latch_RD;

reg [1:0] present_st" title="present_st">present_st, next_st;

//FSM state transition
always @ (posedge clk or negedge Resetn)
begin
if (Resetn == 1'b0)
? present_st <= idle;
else
? present_st <= next_st;?
end

//FSM state definition狀態(tài)機
always @ (present_st, sfr4, CPUWAITn)
begin
case (present_st)
?? idle: case (sfr4)
???????? 3'b000: next_st<= idle;
???????? 3'b011: next_st<= write;
???????? 3'b101: next_st<= read;
???????? default: next_st<= idle;
???????? endcase
?? write: case (CPUWAITn)
????????? 1'b0: next_st<= write;
????????? 1'b1: next_st<= idle;
????????? endcase
?? read: case (CPUWAITn)
???????? 1'b0: next_st<= read;
???????? 1'b1: next_st<= idle;
???????? endcase
?
?? default: next_st <= idle;
endcase
end

//Output definition 輸出定義
always @ (present_st)
begin
case (present_st)
idle: begin
????? sfr7 <= 8'b0;
????? CPUWRn <= 2'b11;
????? CPURDn_int <= 1'b1;
????? CPUMEM <= 1'b0;
?? end
write: begin
?????????? sfr7 <= 8'b00000001;
?????????? CPUWRn <= 2'b00;
?????????? CPURDn_int <= 1'b1;
?????????? CPUMEM <= 1'b1;
???? end
read:? begin
?????????? sfr7 <= 8'b00000001;
?????????? CPUWRn <= 2'b11;
?????????? CPURDn_int <= 1'b0;
?????????? CPUMEM <= 1'b1;
???? end
default: begin
????? sfr7 <= 8'b00000000;
????? CPUWRn <= 2'b11;
????? CPURDn_int <= 1'b1;
????? CPUMEM <= 1'b0;
?? end
endcase
end

//Latching the read data from Core1553 to Core8051
always @ (posedge clk)posedge CPURDn_int)
begin
if (CPURD_int == 1'b0)
?? latch_RD <= CPUDOUT;
end

assign CPURDn = CPURDn_int;

endmodule

更多請訪問

http://www.actel.com/techdocs/appnotes/proasic3.aspx

?

本站內(nèi)容除特別聲明的原創(chuàng)文章之外,,轉(zhuǎn)載內(nèi)容只為傳遞更多信息,并不代表本網(wǎng)站贊同其觀點,。轉(zhuǎn)載的所有的文章,、圖片、音/視頻文件等資料的版權(quán)歸版權(quán)所有權(quán)人所有。本站采用的非本站原創(chuàng)文章及圖片等內(nèi)容無法一一聯(lián)系確認版權(quán)者。如涉及作品內(nèi)容,、版權(quán)和其它問題,請及時通過電子郵件或電話通知我們,,以便迅速采取適當措施,,避免給雙方造成不必要的經(jīng)濟損失。聯(lián)系電話:010-82306118,;郵箱:[email protected]