Made the build system simplify the microcode so that yosys understands and synthesises it! Now gnome_sort.asm almost works!

This commit is contained in:
(Tim) Efthimis Kritikos 2023-11-12 04:04:56 +00:00
parent fa62b07c14
commit e06c0eeaa0
4 changed files with 17 additions and 5 deletions

1
.gitignore vendored
View File

@ -15,4 +15,5 @@ boot_code/*.txt
system/boot_code.bin
system/boot_code.txt
system/obj_dir/
system/simplified_ucode.txt
tools/*svg

View File

@ -1,4 +1,7 @@
INCLUDE dos_layer.asm
.org 0x100
mov sp,#STACK
MAIN_LOOP:
MOV DL,#0xF0
@ -16,11 +19,14 @@ out byte #0xB0
MOV SI,#RESERVED
MOV DI,#RESERVED
MOV AL,#0x68 ; 'h'
MOV [DI],AL
STOSB
MOV AL,#0x00
MOV AL,[SI]
out byte #0xA5
MOV AH,#0x02
MOV DL,AL
INT #0x21
MOV AL,#0x65
out byte #0xA5
MOV AL,#0x6c
@ -47,6 +53,8 @@ MOV AX,#0x0100
JMP AX
RESERVED: DB 0x48 ; 'H'
.BLKB 200
STACK:
.ORG 0xFFF0
MOV AX,#0x0100

View File

@ -71,8 +71,11 @@ ECP5_TARGETS+=abc.history # created from yosys
EXTRA_SYNTHESIS_SOURCES=peripherals/I2C_driver.v peripherals/ascii_to_HD44780_driver.v peripherals/pcf8574_for_HD44780.v
simplified_ucode.txt:ucode.txt
${Q}tr 'x' '0' < $^ | sed 's@//.*@@' | grep ^@ |sort | sed 's/.* .//;s/ $$//' | tr -d _ > $@
#TODO: we are relying on yosys to trim the input program txt file and hope its enough for the whole program...
synth_ecp5.json: ${SOURCES} ${TOP_LEVEL_SOURCE} fpga_config/${FPGA_BOARD}/fpga_top.v ${EXTRA_SYNTHESIS_SOURCES} ${INCLUDES} ../boot_code/colored_led.txt
synth_ecp5.json: ${SOURCES} ${TOP_LEVEL_SOURCE} fpga_config/${FPGA_BOARD}/fpga_top.v ${EXTRA_SYNTHESIS_SOURCES} ${INCLUDES} ../boot_code/colored_led.txt simplified_ucode.txt
${QUIET_YOSYS}
${Q} yosys -q -D BUILTIN_RAM=512 -D NOT_FULL -p 'read -sv '"${SOURCES} ${TOP_LEVEL_SOURCE} fpga_config/${FPGA_BOARD}/fpga_top.v ${EXTRA_SYNTHESIS_SOURCES} ; synth_ecp5 -json $@ -top fpga_top"
@ -101,4 +104,4 @@ upload: upload_orangecrab
.PHONY: clean
clean:
$(call QUIET_CLEAN,system)
${Q}rm -rf ${SYSTEM_VVP} *.fst boot_code.txt boot_code.bin *memdump *memdumptxt obj_dir *json ${ECP5_TARGETS}
${Q}rm -rf ${SYSTEM_VVP} *.fst boot_code.txt boot_code.bin *memdump *memdumptxt obj_dir *json simplified_ucode.txt ${ECP5_TARGETS}

View File

@ -214,7 +214,7 @@ initial begin
end
`else
//TODO: don't have it hard coded
$readmemb("ucode.txt",ucode_rom,0,`UCODE_SIZE-1);
$readmemb("simplified_ucode.txt",ucode_rom,0,`UCODE_SIZE-1);
`endif
end