<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>

新聞中心

EEPW首頁(yè) > 嵌入式系統 > 設計應用 > Spoc CPU軟核 Part 1-Hello world!

Spoc CPU軟核 Part 1-Hello world!

—— Spoc CPU軟核 Part 0-Hello world!
作者: 時(shí)間:2024-01-22 來(lái)源:EEPW編譯 收藏

是一個(gè) cpu...你猜怎么著(zhù)?讓我們用它來(lái)顯示“Hello world!”。在本例中,您需要一個(gè)帶有 RS-232 輸出的 板。

本文引用地址:http://dyxdggzs.com/article/202401/454994.htm
1. 軟件

使用 spoc_asm 編譯以下代碼

// First set the stack pointer (required since we use a subroutine below)  
do #0x0C00 -> SP

BeginString:  
do #GreetingString -> CS

SendChar:  
sel CS.p  
do #0x1000 -> WA0  
do.byte @ -> @  // transmit one byte out of RS-232 TX

// check the RS-232 TX busy bit  
do #0x1000 -> RA0
LoopTxD_ready:  
do.bit @  
jmp.z=1 #LoopTxD_ready

// check the end of string  
do CS-#GreetingStringEnd  
jmp.z=1 #SendChar

// once the string is completely sent, delay before sending again  
jsr #Delay  
jmp #BeginString

// delay subroutine
Delay:  
do.dw #200000 -> A
DelayLoop:  
dec.dw A  
jmp.z=1 #DelayLoop  
ret

GreetingString:  
data.byte "Hello world!", 13
GreetingStringEnd:

// that's all folks

2. 硬件

讓我們將 與 RS-232 TX 模塊連接起來(lái)。合成以下代碼(確保也獲取async_transmitter)。

module spoc_test(clk, TxD);
input clk;
output TxD;

// first instantiate 
wire spoc_WriteData, spoc_WriteEnable, spoc_ReadData;
wire [15:0] spoc_WriteAddress, spoc_ReadAddress;

spoc my_first_spoc
(
    .clk(clk), .ExecuteOpcode_Enable(1'b1), 
    .WriteAddress(spoc_WriteAddress), .WriteData(spoc_WriteData), .WriteEnable(spoc_WriteEnable), 
    .ReadAddress(spoc_ReadAddress), .ReadData(spoc_ReadData)
);

// second hook it up to an RS-232 TX module
reg TxD_start;
reg [7:0] TxD_data;wire TxD_busy;
async_transmitter asyncTX(.clk(clk), .TxD_start(TxD_start), .TxD_data(TxD_data), .TxD(TxD), .TxD_busy(TxD_busy));
always @(posedge clk) if(spoc_WriteEnable) TxD_data[spoc_WriteAddress[2:0]] <= spoc_WriteData;
always @(posedge clk) TxD_start <= spoc_WriteEnable & (spoc_WriteAddress[2:0]==3'h7);
assign spoc_ReadData = TxD_busy;
endmodule
結果

如果您擁有 fpga4fun 開(kāi)發(fā)板,請在配置 后在 conf 中按 CTRL-T 以獲取終端窗口。否則,只需使用您喜歡的終端軟件即可!

上一篇:Spoc CPU軟核(總)

下一篇:Spoc CPU軟核 Part 2-主要特征



關(guān)鍵詞: FPGA Spoc

評論


相關(guān)推薦

技術(shù)專(zhuān)區

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>