--- In , Umair siddiqui
<umairsiddiqui0800@y...> wrote:
>
> First of all thanks for reply.
> Well I want to mimic the Mr.Gray's x16 and MIPS(as
> discribed in "Computer Organization and Design
> The Hardware/Software Interface", 2nd Ed By
> David Patterson and John Hennessy).
> My Constraint is that I specified in project proposal
> that RISC are more suitable than CISC and I'll be
> making RISC...Besides x16 is also RISC and Book is
> recommanded by Mr.Gray (in Article).
One of the scary things about immitating this design is the
complexity. It is a very complex CPU that, due to the pipelining,
has to deal with issues like register interlocking, inserting NOPs
and things like that. A very advanced design by a very accomplished
designer. We're talking about mega doses of steroids pumped into a
Von Neumann machine.
>
> My Qestion are:
> 1) Are Stack-based cpus are more complex than RISC?
> is writing software for stack-based is easy as
> compared
> to RISC?
I don't think stack based CPUs are more complex than RISC or CISC
but I think there are less fully developed examples around to
immitate. Not just in terms of hardware but in terms of software
tools. A long time ago Burroughs computers were stack oriented and
I think they used Algol but I could be way off on that.
As to RISC vs CISC - well that is a matter of conjecture in terms of
designing the CPU. After all, they are both implemented with state
machines. In my opinion, the selling point for RISC is that the
smaller, more regular, instruction set lends itself to pipelining
and speed. At the application level, programs still want to move
strings, extract characters from words or strings, and so forth. If
the instruction set contains string oriented op codes the execution
is probably pretty quick. If the instruction set omits op codes
then they have to be created from the more primitive codes. It
still has to be done.
>
> 2) I've learned (intermediate level)c++, java
> programming but never worked with forth,
> so how is the learning curve of Forth? recommended
> Forth tools (Win32), Books, other learning resources?
>
Forth is a non-starter, in my opinion. It has the advantage of an
integrated enviornment (a text editor) as does Basic. But Forth is
implemented bottom-up. The low level primitives have to be written
first and higher levels of code stacked on top. This is somewhat
contrary to top-down structured programming.
However, I have seen an elegant use of Forth: many years ago one of
the early hard disk manufacturers used it for all of their
diagnostic software at test stations. Here, the bottom-up approach
was perfect: write some code to read and write ports, layer it with
code to read and write sectors and layer that with code to debug the
disk. These test stations were quite nice and using Forth, new
diagnostics could be written in seconds because everything was
written in terms of known working primitives.
It remains a question to me whether a Pascal compiler could be
written in Forth and if it was whether any person other than the
writer could figure out how it worked.
Also, I believe Forth is an interpreted language. I don't think it
generates machine code. So, you would have to design some hardware
that would be sufficient to run Forth as compiled by a compiler that
doesn't exist for the hardware you are designing. You would be
creating 2 layers of software instead of one.
> 3) porting GCC C-compiler to x16 or any
custumized
> architecture(optimzed for fpga) HOWTO -- as it is also
> retargetable?
Yes, GCC is retargetable but there is a reason Mr Gray chose LCC,
the retargetable C compiler. There is a book written by Fraser and
Hanson titled "A Retargetable C Compiler: Design and Implmentation"
that walks through the entire process detailing every piece that
needs to be implemented.
The only issue I see with either GCC or LCC is that they are
complete languages implementing every feature of ANSI C. So, the
assumptions they make about the capabilities of hardware in terms of
stack, index registers, base registers, etc. means you have to
implement a pretty complete machine. Like a MIPS or X16.
I still like the idea of a tiny language and a language oriented
CPU. The more I think about it, the more I would recommend the tiny
Pascal compiler/interpreter in Wirth's "Algorithms + Data Structures
= Programs". The CPU would have to implement 8 basic instructions
and 13 operators. To the basic language there would need to be a
couple of standard procedures/functions to read and write ports and
perhaps read and write files.
In my concept the interpreter would run in hardware. There would be
boot code and perhaps a command interpreter placed in Block RAM so
the machine could start interpreting directly at boot. If the
standard procedures/functions for PORT I/O are implemented then the
command processor could do things like read or write a hard drive
(probably a Compact Flash - I love those things) to load other code
for execution. Note that the PL0 compiler can not compile the
compiler so code will have to be written on a PC and executed on the
FPGA. The PL0 compiler itself is only 10 pages of text so it isn't
a huge project to get it running on a PC, whether Linux or Windows
using some Pascal compiler such as FreePascal (www.freepascal.org).
The Xilinx Starter Board comes with a VGA display and the VHDL code
is provided. Keyboard code is available at www.opencores.org as is
a very nice serial port as a component of the T80 project.
What you could wind up with is an implementation of a language
oriented computer that is extensible in the sense that the full
Pascal language as implemented by Wirth, et al. could eventually be
developed.
I am planning to build the original Wirth Pascal system for my own
purposes but, thinking about it, maybe I will do the PL0 system
first and see where it leads.
>
/////////////////////////////////////////////////////
> Please Note that
> -CPU should be compatible to x16
> -I have build similar system like xsoc -- with
> vga/lcd, keyboard and serial port
The Xilinx Spartan 3 Starter Board has all these ports - nothing to
add, hardware wise except the code to drive them.
> _______________________________
>
|