You need to log in to create posts and topics.

how to compile examples/Logic/8bit_cpu/prog-1.sac

which compiler should be used, please help me ! thanks for your kind help.

Hi.
The compiler for those files was removed some time ago.
The only way is to compile it by hand or create an script to do it.

In any case that project is just an experiment, not sure if it can be useful for you.

prog-.sac as below

0 NOP
1 STM 1
2 LDI 4
3 ADD 1
4 JPI 1

opcode as below

codeBits = 4

INC = 0
RLA = 1
ADD = 2
SUB = 3
AND = 4
OR = 5
XOR = 6
NOT = 7

LDI = 8
LDM = 9
STM = 10
JPI = 11
JPZ = 12
JPC = 13
JPN = 14
NOP = 15

so i tanslate the prog-1.sac to prog-1.data as below

000F,001A,0048,0012,001B

 

could you please help to verify whether is correct. thank you very much.

 

 

Hi.

I think the translation is correct but you need to use decimal values.

In any case that program does nothing interesting, It was just some test.
This one for example does something: increments a value.

0  NOP
1  LDM 1
2  INC
3  STM 1
4  JPI 1

And it translates to:
15,25,0,26,27

What it does:
1- Load value from RAM at address 1 to Accumulator.
2- Increment Accumulator (does not load result back to Acc., it just remains in ALU output Reg. Y)
3- Stores content of Y (ALU output Reg.) to RAM at adress 1.
4- Jump to 1.

Note that the result of opperations don't go to the Accumulator in this circuit.

---

Some background:

This CPU was made many years ago just as an exercise to create a very simple instruction set.
And the compiler was just a very simple "translator".

In later versions the system to add and configure compilers was changed and this one was disabled because it was of little use.
I can try to enable it again if there is some interest, but it is useful only for simple cases.

Opcode and argument (if any) are joined in a single intruction, with opcode at lower bits and argument in subsequent bits.
That's all what it does, but translating by hand is a real headache,