From 6561018206d8126b8f646d824f96f278924ca82a Mon Sep 17 00:00:00 2001 From: "(Tim) Efthimis Kritikos" Date: Fri, 10 Feb 2023 14:08:39 +0000 Subject: [PATCH] Made the processor actually little-endian --- cpu/boot_code.asm | 8 ++++---- cpu/processor.v | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cpu/boot_code.asm b/cpu/boot_code.asm index 714cca9..4b013f9 100644 --- a/cpu/boot_code.asm +++ b/cpu/boot_code.asm @@ -1,4 +1,4 @@ -ADD AX,#0x55AA -ADD CX,#0xEFBE -ADD CX,#0x1141 -ADD AX,#0x1111 +ADD AX,#0xDEAD +ADD CX,#0xBEEF +ADD CX,#0x4111 +ADD AX,#0x2200 diff --git a/cpu/processor.v b/cpu/processor.v index c669f1e..23351ec 100644 --- a/cpu/processor.v +++ b/cpu/processor.v @@ -219,17 +219,18 @@ always @(posedge clock) begin end `PROC_DE_LOAD_16_PARAM:begin if(unaligned_access==1)begin - PARAM1[15:8] = external_data_bus[7:0]; + PARAM1[7:0] = external_data_bus[7:0]; ProgCount=ProgCount+1; state=`PROC_DE_LOAD_16_EXTRA_FETCH_SET; end else begin - PARAM1 <= external_data_bus; + PARAM1[7:0] = external_data_bus[15:8]; + PARAM1[15:8] = external_data_bus[7:0]; ProgCount=ProgCount+1; state=`PROC_EX_STATE_ENTRY; end end `PROC_DE_LOAD_16_EXTRA_FETCH:begin - PARAM1[7:0] = external_data_bus[15:8]; + PARAM1[15:8] = external_data_bus[15:8]; state=`PROC_EX_STATE_ENTRY; end `PROC_EX_STATE_ENTRY:begin