lcytms 发表于 2017-3-7 22:28:34

CPU86——免费版 8088 FPGA IP Core(VHDL源代码下载)

本帖最后由 lcytms 于 2017-3-8 13:46 编辑

CPU86——免费版 8088 FPGA IP Core(VHDL源代码下载)

信息来源:http://www.ht-lab.com/cpu86.htm

Introduction date: June 8, 1978
Clock speeds: 5 MHz (0.33 MIPS)
                        8 MHz (0.66 MIPS)
                        10 MHz (0.75 MIPS)
Number of transistors: 29,000 (3 microns)
Bus width: 16 bits
Addressable memory: 1 Megabyte
Typical use: Portable computing
Ten times the performance of the 8080

推出日期:1978年6月8日
时钟频率:5 MHz(0.33 MIPS)
                8 MHz(0.66 MIPS)
                10 MHz(0.75 MIPS)
晶体管数量:29000(3微米)
总线宽度:16位
可寻址内存:1 MB
典型应用:便携式计算
性能为8080的十倍

lcytms 发表于 2017-3-7 22:36:57

本帖最后由 lcytms 于 2017-3-8 13:46 编辑

CPU86
On this page you will find an FPGA IP Core implementation of an 8088 processor.
The CPU86 core is binary/ instruction compatible with an iAPX8088 processor and can be implemented in any modern FPGA.
The core is however not cycle or timing accurate.
The CPU86 is ideally suited for a small embedded 8088 legacy system.
The CPU86 comes with a simple testbench instantiating the processor core together with a 256 byte ROM model, a 256Kbyte SRAM model and a 16750 UART from opencores.org.
The SRAM model is pre-loaded with the MON88 debugger and the ROM contains a simple "Jump to MON88 after reset" program.
The testbench monitors the UART and copies any newline terminated strings to the Modelsim transcript window, it also contains a simple function to transmit command strings back to the debugger.

CPU86
在这个网页你会发现一个用FPGA的IP核实现的8088处理器。
这个CPU86内核从二进制/指令两方面和 iAPX8088处理器兼容,可以在任何一个现代的FPGA上实现。
但是这个内核不能进行循环或者准确定时。
CPU86非常适合遗留下来的小型嵌入式8088系统。
CPU86带有一个简单的 testbench,用于实例化处理器内核,加上256字节的ROM模型,一个256k字节的SRAM模型和一个来自opencores.org的16750 UART。
SRAM模型与MON88调试器一起预加载,ROM里面包含一个简单的“复位后跳转至MON88”的程序。
testbench监控UART,并复制所有发到Modelsim记录窗口的换行终止字符串,它还包含了一个简单的函数来发送命令字符串返回调试器。

lcytms 发表于 2017-3-7 22:55:38

本帖最后由 lcytms 于 2017-3-8 13:47 编辑

License Agreement
The CPU86 source code is licensed under the GNU General Public License v2 or v3

许可协议
CPU86的源代码获得了GNU通用公共许可证v2或v3的许可

lcytms 发表于 2017-3-7 23:01:19

本帖最后由 lcytms 于 2017-3-8 10:30 编辑

Download Source Files下载源文件

•Download CPU86 IP source files (version 0.82, 549KB, zipped)下载CPU86 IP源文件(0.82版本,549kb,zipped)
        Version 0.82 : RCR REG,CL with CF set not always produced the right results, fixed. RCR REG,Cl与CF集并不总是产生正确的结果,进行修订。
        Version 0.81 : Fixed CALL instruction, under certain circumstances the segment register was not set to use CS. 修订 CALL 指令,在某些情况下段寄存器没有被设置为使用CS。
        Version 0.80 : Minor update, changed ISE to version 11.1, it now simulates under ISIM. 进行了小的更新,ISE版本变为 11.1版,现在是在ISIM下仿真。
        Version 0.79 : All source code released under GNU, fixed DAS/AAA/AAS instructions, 26 June 2008. 发布了在GNU下面的全部源代码,修订了DAS / AAA / ASA指令,2008年6月26日。
        Version 0.75 : Transferred some bug fixes from the HTL8088 to the CPU86. Amongst the bug fixes are the Divide by   Zero interrupt fix, LES SI, fix and AAM/AAD instruction fix.
                将一些bug的修订从HTL8088传送到CPU86。修订了以下几个bug:除以零中断的修订,LES SI,的修订和AAM/AAD指令的修订。
        Version 0.70 : Fixed trace interrupt (broken in ver 0.68). Split design into individual files so that it can be synthesized with XST. 修订了跟踪中断(在0.68版本中有断点)。把设计分割成单独的文件,以便它可以用XST进行综合。
                Changed UART to opencores one. Replaced vendor memory models. Simplified simulation. 把UART换成了开放内核。更换了供应商的内存模型。简化仿真。
        Version 0.69 : Fixed INTR logic and SHL instruction. 修订了INTR逻辑和SHL指令。
        Version 0.68 : Fixed INTA vector read, version 0.67 always read 0 during the second INTA cycle. 修订了INTA向量读,0.67版总是在第二个INTA周期中读0。
        Version 0.67 : Synthesisable version Released on the web 22 December 2005 可综合的网上版本,2005年12月22日发布
        Version 0.10 : Simulation model only, 02 October 2004 单一的仿真模型,2004年10月02日

Directory structure in the zipfile:
        CPU86\bin                 Contains the different conversion programs (Windows, DOS). 包含不同的转换程序(Windows、DOS)。
        CPU86\cpu86_rtl        CPU86 Synthesizable VHDL Source files. CPU86可综合的VHDL源文件。
        CPU86\drigmorn1         Implementation example for the Enterpoint Drigmorn1 board, ISE 12.1 project file is included. 用于Enterpoint Drigmorn1板的实现例程,包括ISE 12.1工程文件。
        CPU86\Modelsim         Modelsim Simulation batch file.       Modelsim仿真批处理文件。
        CPU86\Opencores         VHDL source code for the Opencores 16750 compatible UART.用于和开放内核16750兼容的UART的VHDL源代码。
        CPU86\Software         ROM, MON88 and some example asm source files.        ROM,MON88和一些实例汇编源文件。
        CPU86\testbench         Contains VHDL testbench files for CPU86+UART+256Byte ROM (see top_rtl dir).        包含VHDL测试文件CPU86+UART+256字节ROM(见top_rtl目录)。
        CPU86\top_rtl                 Contains simple top level example file used for Simulation only.        包含简单的顶层实例文件,仅用于仿真。

lcytms 发表于 2017-3-7 23:13:00

本帖最后由 lcytms 于 2017-3-8 13:49 编辑

Tools/Software used

•Modelsim 6.5a SE,Note: PE, OEM and older versions of Modelsim can also be used, ISIM also works fine
•Eric Isaacson free A86 assembler (Optional)
•MON88 Debug Monitor (source and hexfile included in the zipfile)
• Precision RTL Synthesis (Synplify, XST and QNS can also be used).

使用的工具/软件

•ModelSim 6.5a SE,注意:PE、OEM和旧版本的Modelsim也能用,ISIM也很好
•Eric Isaacson免费版A86汇编器(可选)
•MON88调试监控程序(源和hexfile包含在zip压缩文件中)
• Precision RTL综合工具(也可以用Synplify、XST和QNS)。

lcytms 发表于 2017-3-7 23:19:29

本帖最后由 lcytms 于 2017-3-8 11:57 编辑

Simulation using Modelsim        用Modelsim进行仿真

1.Download the zipfile and unzip to a suitable directory (keep the directory structure)        下载zip压缩文件,解压到一个合适的目录(保持目录结构)
2.Open a DOSBox or Cygwin Shell and navigate to the CPU86/Modelsim directory        打开DOSBox或Cygwin Shell程序,并转到CPU86/Modelsim目录
3.Make sure that the Modelsim win32/win32pe directory is in your search path, then execute run.bat        确认ModelSim的win32/win32pe目录在您的搜索路径里面,然后执行run.bat

Modelsim will be invoked in the command line mode (vsim -c), the output should look something like this:        Modelsim会用命令行方式进行调用(vsim -c),输出应该是这个样子:

# RD UART : MON88 8088/8086 Monitor ver 0.12
# RD UART : Copyright WWW.HT-LAB.COM 2005-2008
# RD UART : All rights reserved.# RD UART :
# RD UART :Cmd>R
# RD UART : AX=0000 BX=0001 CX=0002 DX=0003 SP=0100 BP=0005 SI=0006 DI=0007
# RD UART : DS=0380 ES=0380 SS=0380 CS=0380 IP=0100   ODIT-SZAPC=0000-00100
# RD UART : 0380:0100 0000         ADD    , AL
# RD UART :Cmd>DM 0100-0124
# RD UART : 0380:010000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
# RD UART : 0380:011000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
# RD UART : 0380:012000 00 00 00                                       ....
VSIM 2>

Note: if you compile the files manually then make sure you suppress all warnings from the Synopsys and IEEE Numeric packages (see CPU86/Modelsim/tb.tcl for the Modelsim commands).
        If you don't do this then the UART messages will be lost in the large number of UXWZ warning messages.
注意:如果你手动编译文件,请确认你已经压制从Synopsys和IEEE数字包来的所有的警告(见CPU86/Modelsim/tb.tcl的Modelsim命令)。
        如果你不这样做的话,UART的信息将大量的UXWZ警告信息中丢失。

# ** Warning: There is an 'U'|'X'|'W'|'Z'|'-' in an arithmetic operand, the result will be 'X'(es).
#    Time: 802475 nsIteration: 7Instance: /top_tb/fpga/cpu/cpubiu/shift

Note: If you are using Linux then check that all filenames have the right case. You might also want to run the dos2unix command on all the vhdl and bat files (removes the DOS CR character). You can execute the same batch file by making it executable (chmod +x run.bat).
注意:如果你使用的是Linux,请检查所有的文件名都正确。你可能还想在所有的VHDL和BAT文件上面跑dos2unix命令(删除DOS CR字符)。你可以使它变成可执行文件,然后执行相同的批处理文件(chmod +x run.bat)。

lcytms 发表于 2017-3-7 23:22:48

本帖最后由 lcytms 于 2017-3-8 13:52 编辑

Simulating using ISIM        

As of ISE11.1 you can now simulate the design using ISIM.
Navigate to the Drigmorn1 directory and open the Drigmorn1.ise project file.
Next run ISIM on the cpu86_top_tb file.
Change the radix of the udbus signal to ASCII, this signal is the output of the UART monitor and will contain the mon88 output string.
Run the simulation for say 100 ms and you should get an output similar to the screenshot shown below:

使用ISIM进行仿真

作为ISE11.1您现在可以使用ISIM对设计进行仿真。
导航到Drigmorn1目录,打开Drigmorn1.ise工程文件。
然后在cpu86_top_tb文件上运行ISIM。
修改udbus 信号ASCII的基数为ASCII,该信号是UART监控程序的输出项,而且将包含mon88输出字符串。
运行仿真,比如说100毫秒,你应该得到一个输出,类似于下面的截图:

lcytms 发表于 2017-3-7 23:24:31

本帖最后由 lcytms 于 2017-3-8 13:56 编辑

Synthesis

The CPU86 core can be synthesized using any modern synthesis tool such as Mentor's Precision, XST, QNS and Synplify (note : the last one has not been verified but I will be surprised if it can't handle the code).

综合

CPU86内核可以使用任何现代的综合工具进行综合,如Mentor的Precision、XST、QNS和Synplify(注:最后一项还没有去验证,但如果它不能处理代码的话,我会感到惊讶)。

lcytms 发表于 2017-3-7 23:30:47

本帖最后由 lcytms 于 2017-3-8 14:38 编辑

Supplied Testbench        提供的测试平台

The CPU86 Model is supplied with a simple testbench.         针对CPU86的模型提供了一个简单的testbench。
The testbench monitors what the CPU is writing to the UART and displays the received string onto the transcript window.        
testbench监控CPU写入UART的数据,并将接收到的字符串显示到记录窗口中。
The testbench also writes a few commands to the UART after some initial delay (see tester_behaviour.vhd).       
在初始延迟之后,testbench还写了几个命令到UART上(见tester_behaviour.vhd)。

# RD UART : AX=0000 BX=0000 CX=0000 DX=0000 SI=0000 DI=0000 FX=0000 ----------------
# WR UART : FM 0000,0020 A5

The 1Mbyte 8086 memory map is filled in 2 places, the top 256 bytes contains a simple ROM model (instance U11 in cpu86_top_struct.vhd).        
1M字节的8086内存映射在2个地方,前256个字节包含一个简单的ROM模型(cpu86_top_struct.vhd中的实例U11)。
This ROM is created by the create_rom.bat batch file located in the Software/Bootloader directory.                
这个ROM是由create_rom.bat批处理文件创建的,该文件位于Software/Bootloader目录。
This batch file assembles the jump0400.asm file using A86 followed by converting it to a VHDL case statement (using CPU86/bin/bin2case.exe).        
该批处理文件使用A86来编译jump0400.asm文件,然后将其转换成VHDL的case语句(使用CPU86/bin/bin2case.exe)。
The jump0400.asm file does nothing else but to jump to address 0000:0400 after reset.        
在复位之后,jump0400.asm文件仅仅是跳转到地址0000:0400,而不做其它工作。
The 0000:0400 address is just above the 8086 interrupt vector table and is the start address of the MON88 debugger.               
该0000:0400地址就在8086个中断向量表的上面,是MON88调试程序的开始地址。

The MON88 debugger is created by the mon88.bat batch file located in the CPU86/Software/Mon88 directory.
MON88调试程序是由mon88.bat批处理文件创建的,该文件在CPU86/Software/Mon88目录下。
This batch file assembles the monitor followed by converting it (using bin/bin2mem.exe) to a format suitable for Andre Klindworth's SRAM model (write result to loadfname.dat).
该批处理文件对监控程序进行编译,然后将其转换成(使用bin/bin2mem.exe)和Andre Klindworth的SRAM模型相匹配的格式(结果写到loadfname .dat)。
This memory model is instantiated in the testbench and filled with the loadfname.dat file during simulation.
该内存模型在testbench中进行实例化,并在仿真的时候填写loadfname.dat文件数据。

When the testbench issues a reset the processor jumps to FFFF:0000 (CS:IP) and then jumps to 0000:0400 which start the mon88 monitor.
当testbench产生复位的时候,处理器跳转到FFFF:0000(CS:IP),然后跳到0000:0400开始的mon88监控程序。
The testbench waits for the monitor's command prompt (Cmd>) and then issues the Display Register command (R), followed by a Dump Memory (DM 0000-0020) command.
testbench等待监控程序的命令提示符(CMD>),然后启动显示寄存器命令(R),随后是内存转储(DM 0000-0020)命令。
               
write_to_uart('R');               -- Issue the command R (dump Registers)
write(L,string'("WR UART : R"));
writeline(output,L);wait for 47 ms;                     -- wait for > prompt before issuing the next command

You can easily change or extend the commands issued.        你可以轻松地对发出的命令进行改变或扩展。

lcytms 发表于 2017-3-7 23:34:58

本帖最后由 lcytms 于 2017-3-8 15:00 编辑

Software Development

The CPU86 is binary compatible with the 8088/8086 which means that most software available for the 8086 should run without any issues on the CPU86.
There are a number of software differences between the CPU86 and Intel's iAPX88.
The first one is that the CPU86 has a 9 byte prefetch queue instead of 4 bytes on the iAPX88.
This means that CPU Identification routines, which rely on the length of the prefetch queue, will not be able to detect if an 8088 or 8086 is present.
The second difference is the number of clock cycles per instruction.
Software routines that count the number of clockcycles to implement a software delay will not be accurate (consider bad coding style anyway).
The LOCK and WAIT prefixes are not supported (ignore, executed as NOP's).

There is a vast amount of software available for the 8088/8086 including high-level compilers, linkers, debuggers, operating systems, application software etc, most of which can be downloaded for free.

软件开发

CPU86是二进制兼容于8088 / 8086,这意味着用于8086的大多数软件可以在CPU86上没有任何问题地运行。
CPU86和英特尔的iAPX88之间有许多的软件差异。
第一项差异是CPU86有一个9字节的预取队列,而不同于 iAPX88的4字节。
这意味着CPU识别程序,由于依赖于预取队列的长度,将无法确定使用的是一个8088还是8086。
第二项差异是每条指令的时钟周期数。
软件程序,如果通过对时钟周期数进行计数来实现软件延时的话,结果不会准确(考虑不好的编码风格吧)。
不支持LOCK和WAIT的前缀(忽略,可以执行NOP之类)。

有大量的软件可用于8088/8086,包括高级编译器、连接器、调试器、操作系统、应用软件等,其中大部分可以免费下载。
页: [1] 2
查看完整版本: CPU86——免费版 8088 FPGA IP Core(VHDL源代码下载)