diff options
| author | Vaino Kauppila <vaino@vke.fi> | 2026-04-19 12:32:58 +0300 |
|---|---|---|
| committer | Vaino Kauppila <vaino@vke.fi> | 2026-04-19 12:32:58 +0300 |
| commit | eb8643ddbef43547eb7bfe58789a3908926c7258 (patch) | |
| tree | fadfba88a1c71b266b8c67df166a3a6ead6b30d1 | |
| parent | 129a1c975dbd0c042576010b1f6eb40d19fc5733 (diff) | |
| download | vhdl_pic-eb8643ddbef43547eb7bfe58789a3908926c7258.tar.gz vhdl_pic-eb8643ddbef43547eb7bfe58789a3908926c7258.zip | |
refactor dir structure, add fib.c
| -rw-r--r-- | .gitignore | 25 | ||||
| -rw-r--r-- | Makefile | 41 | ||||
| -rw-r--r-- | Makefile.inner | 96 | ||||
| -rw-r--r-- | PIC/prog_rom.vhd | 1045 | ||||
| -rw-r--r-- | fw/blink.c (renamed from PIC/blink.c) | 0 | ||||
| -rw-r--r-- | fw/fib.c | 84 | ||||
| -rw-r--r-- | fw/test_uart.c (renamed from PIC/test_uart.c) | 10 | ||||
| -rw-r--r-- | hdl/ALU.vhd (renamed from PIC/ALU.vhd) | 0 | ||||
| -rw-r--r-- | hdl/PIC.vhd (renamed from PIC/PIC.vhd) | 0 | ||||
| -rw-r--r-- | hdl/common.vhd (renamed from PIC/common.vhd) | 0 | ||||
| -rw-r--r-- | hdl/decoder.vhd (renamed from PIC/decoder.vhd) | 0 | ||||
| -rw-r--r-- | hdl/dpram.vhd (renamed from PIC/dpram.vhd) | 0 | ||||
| -rw-r--r-- | hdl/fifo.vhd (renamed from PIC/fifo.vhd) | 0 | ||||
| -rw-r--r-- | hdl/hdl-prj.json (renamed from PIC/hdl-prj.json) | 0 | ||||
| -rw-r--r-- | hdl/hexfile_reader.vhd (renamed from PIC/hexfile_reader.vhd) | 0 | ||||
| -rw-r--r-- | hdl/pic_top.vhd (renamed from PIC/pic_top.vhd) | 0 | ||||
| -rw-r--r-- | hdl/stack.vhd (renamed from PIC/stack.vhd) | 0 | ||||
| -rw-r--r-- | hdl/state_machine.vhd (renamed from PIC/state_machine.vhd) | 8 | ||||
| -rw-r--r-- | hdl/tb_pic.vhd (renamed from PIC/tb_pic.vhd) | 2 | ||||
| -rw-r--r-- | hdl/tb_stack.vhd (renamed from PIC/tb_stack.vhd) | 0 | ||||
| -rw-r--r-- | hdl/uart.vhd (renamed from PIC/uart.vhd) | 0 | ||||
| -rw-r--r-- | test_uart.c | 0 | ||||
| -rw-r--r-- | test_uart.hex | 50 |
23 files changed, 173 insertions, 1188 deletions
@@ -1,28 +1,13 @@ -# GHDL build artifacts -*.o -e~*.o -work-obj*.cf -tb_pic -tb_stack +# All build artifacts land in build/ +build/ -# Simulation output -*.vcd - -# Synthesis / P&R outputs -*.json -!PIC/hdl-prj.json -*.fs -*_pnr.json -*_timing.json - -# SDCC compiler outputs +# SDCC compiler outputs that may land alongside source *.asm *.cod *.lst *.ihx -program.hex -# Keep test_uart.hex — it's the assembled firmware -# (remove this comment and add test_uart.hex here if you regenerate it from source) +*.hex +hdl/prog_rom.vhd # Python cache __pycache__/ @@ -1,54 +1,55 @@ IMAGE = fpga-tools PODMAN = podman run --rm -v $(CURDIR):/workspace $(IMAGE) +BUILD = build + # Which C program to build. Override: make PROG=test_uart PROG ?= blink -# ── Host-side C compilation (sdcc on host) ────────────────────────────────── +$(BUILD): + mkdir -p $@ -blink.hex: PIC/blink.c - sdcc --use-non-free -mpic14 -p16f84a $< +# -- Host-side C compilation (sdcc on host) -------------------------------------------- -test_uart.hex: PIC/test_uart.c - sdcc --use-non-free -mpic14 -p16f84a $< +$(BUILD)/%.hex: fw/%.c | $(BUILD) + cd $(BUILD) && sdcc --use-non-free -mpic14 -p16f84a $(CURDIR)/fw/$*.c # program.hex is what the testbench loads at runtime -program.hex: $(PROG).hex +$(BUILD)/program.hex: $(BUILD)/$(PROG).hex cp $< $@ # prog_rom.vhd embeds the program for synthesis -PIC/prog_rom.vhd: program.hex +hdl/prog_rom.vhd: $(BUILD)/program.hex python3 hex2rom.py $< > $@ # Regenerate ROM from an arbitrary hex file: make rom HEX=foo.hex rom: - python3 hex2rom.py $(HEX) > PIC/prog_rom.vhd + python3 hex2rom.py $(HEX) > hdl/prog_rom.vhd -# ── Container targets ──────────────────────────────────────────────────────── +# -- Container targets ---------------------------------------------------------------------------- -all: PIC/prog_rom.vhd +all: hdl/prog_rom.vhd $(PODMAN) make -f Makefile.inner -sim: program.hex +sim: $(BUILD)/program.hex $(PODMAN) make -f Makefile.inner sim -flash: pic_top.fs +flash: $(BUILD)/pic_top.fs openFPGALoader -b tangprimer25k $< show-top: - $(PODMAN) make -f Makefile.inner pic_top.dot - xdot pic_top.dot + $(PODMAN) make -f Makefile.inner $(BUILD)/pic_top.dot + xdot $(BUILD)/pic_top.dot show-uart: - $(PODMAN) make -f Makefile.inner uart.dot - xdot uart.dot + $(PODMAN) make -f Makefile.inner $(BUILD)/uart.dot + xdot $(BUILD)/uart.dot -# ── Clean ──────────────────────────────────────────────────────────────────── +# -- Clean ---------------------------------------------------------------------------- clean: $(PODMAN) make -f Makefile.inner clean - rm -f program.hex PIC/prog_rom.vhd - rm -f blink.hex blink.asm blink.cod blink.lst - rm -f test_uart.hex test_uart.asm test_uart.cod test_uart.lst + rm -rf $(BUILD) + rm -f hdl/prog_rom.vhd .PHONY: all sim clean flash show-top show-uart rom diff --git a/Makefile.inner b/Makefile.inner index 3184cc3..957843c 100644 --- a/Makefile.inner +++ b/Makefile.inner @@ -1,4 +1,5 @@ -PIC_DIR = PIC +HDL_DIR = hdl +BUILD = build DEVICE = GW5A-LV25MG121NES FAMILY = GW5A-25A @@ -10,72 +11,71 @@ STD = --std=08 # Synthesizable sources (no testbenches, no VHDL file-I/O packages) SYN_FILES = \ - $(PIC_DIR)/common.vhd \ - $(PIC_DIR)/decoder.vhd \ - $(PIC_DIR)/fifo.vhd \ - $(PIC_DIR)/uart.vhd \ - $(PIC_DIR)/ALU.vhd \ - $(PIC_DIR)/stack.vhd \ - $(PIC_DIR)/dpram.vhd \ - $(PIC_DIR)/state_machine.vhd \ - $(PIC_DIR)/PIC.vhd \ - $(PIC_DIR)/prog_rom.vhd \ - $(PIC_DIR)/pic_top.vhd + $(HDL_DIR)/common.vhd \ + $(HDL_DIR)/decoder.vhd \ + $(HDL_DIR)/fifo.vhd \ + $(HDL_DIR)/uart.vhd \ + $(HDL_DIR)/ALU.vhd \ + $(HDL_DIR)/stack.vhd \ + $(HDL_DIR)/dpram.vhd \ + $(HDL_DIR)/state_machine.vhd \ + $(HDL_DIR)/PIC.vhd \ + $(HDL_DIR)/prog_rom.vhd \ + $(HDL_DIR)/pic_top.vhd # Simulation adds the hex-reader package and testbenches SIM_FILES = \ - $(PIC_DIR)/common.vhd \ - $(PIC_DIR)/decoder.vhd \ - $(PIC_DIR)/hexfile_reader.vhd \ - $(PIC_DIR)/fifo.vhd \ - $(PIC_DIR)/uart.vhd \ - $(PIC_DIR)/ALU.vhd \ - $(PIC_DIR)/stack.vhd \ - $(PIC_DIR)/dpram.vhd \ - $(PIC_DIR)/state_machine.vhd \ - $(PIC_DIR)/PIC.vhd + $(HDL_DIR)/common.vhd \ + $(HDL_DIR)/decoder.vhd \ + $(HDL_DIR)/hexfile_reader.vhd \ + $(HDL_DIR)/fifo.vhd \ + $(HDL_DIR)/uart.vhd \ + $(HDL_DIR)/ALU.vhd \ + $(HDL_DIR)/stack.vhd \ + $(HDL_DIR)/dpram.vhd \ + $(HDL_DIR)/state_machine.vhd \ + $(HDL_DIR)/PIC.vhd TB_FILES = \ - $(PIC_DIR)/tb_stack.vhd \ - $(PIC_DIR)/tb_pic.vhd + $(HDL_DIR)/tb_stack.vhd \ + $(HDL_DIR)/tb_pic.vhd -all: $(TOP).fs +all: $(BUILD)/$(TOP).fs + +$(BUILD): + mkdir -p $@ # Synthesize -$(TOP).json: $(SYN_FILES) - ghdl -a $(STD) $(SYN_FILES) - yosys $(MODULE) -p "ghdl $(STD) $(TOP); memory_map; synth_gowin -json $@ -family gw5a" +$(BUILD)/$(TOP).json: $(SYN_FILES) | $(BUILD) + ghdl -a $(STD) --workdir=$(BUILD) $(SYN_FILES) + yosys $(MODULE) -p "ghdl $(STD) --workdir=$(BUILD) $(TOP); memory_map; synth_gowin -json $@ -family gw5a" # Place and route -$(TOP)_pnr.json: $(TOP).json $(CST) +$(BUILD)/$(TOP)_pnr.json: $(BUILD)/$(TOP).json $(CST) nextpnr-himbaechel --json $< --write $@ \ --device $(DEVICE) --vopt family=GW5A-25A --vopt cst=$(CST) \ - --vopt sspi_as_gpio --freq 50 --report $(TOP)_timing.json + --vopt sspi_as_gpio --freq 50 --report $(BUILD)/$(TOP)_timing.json # Pack bitstream -$(TOP).fs: $(TOP)_pnr.json +$(BUILD)/$(TOP).fs: $(BUILD)/$(TOP)_pnr.json gowin_pack --sspi_as_gpio --cpu_as_gpio -d $(FAMILY) -o $@ $< -sim: $(SIM_FILES) $(TB_FILES) - ghdl -a $(STD) $(SIM_FILES) $(TB_FILES) - ghdl -e $(STD) tb_stack - ghdl -r $(STD) tb_stack - ghdl -e $(STD) tb_pic - ghdl -r $(STD) tb_pic --vcd=tb_pic.vcd +sim: $(SIM_FILES) $(TB_FILES) | $(BUILD) + ghdl -a $(STD) --workdir=$(BUILD) $(SIM_FILES) $(TB_FILES) + ghdl -e $(STD) --workdir=$(BUILD) -o $(BUILD)/tb_stack tb_stack + ghdl -r $(STD) --workdir=$(BUILD) tb_stack + ghdl -e $(STD) --workdir=$(BUILD) -o $(BUILD)/tb_pic tb_pic + ghdl -r $(STD) --workdir=$(BUILD) tb_pic --vcd=$(BUILD)/tb_pic.vcd -pic_top.dot: $(SYN_FILES) - ghdl -a $(STD) $(SYN_FILES) - yosys $(MODULE) -p "ghdl $(STD) $(TOP); show -format dot -prefix pic_top" +$(BUILD)/pic_top.dot: $(SYN_FILES) | $(BUILD) + ghdl -a $(STD) --workdir=$(BUILD) $(SYN_FILES) + yosys $(MODULE) -p "ghdl $(STD) --workdir=$(BUILD) $(TOP); show -format dot -prefix $(BUILD)/pic_top" -uart.dot: $(PIC_DIR)/fifo.vhd $(PIC_DIR)/uart.vhd - ghdl -a $(STD) $(PIC_DIR)/fifo.vhd $(PIC_DIR)/uart.vhd - yosys $(MODULE) -p "ghdl $(STD) uart; show -format dot -prefix uart" +$(BUILD)/uart.dot: $(HDL_DIR)/fifo.vhd $(HDL_DIR)/uart.vhd | $(BUILD) + ghdl -a $(STD) --workdir=$(BUILD) $(HDL_DIR)/fifo.vhd $(HDL_DIR)/uart.vhd + yosys $(MODULE) -p "ghdl $(STD) --workdir=$(BUILD) uart; show -format dot -prefix $(BUILD)/uart" clean: - rm -f $(TOP).json $(TOP)_pnr.json $(TOP).fs $(TOP)_timing.json - rm -f pic_top.dot uart.dot - rm -f *.o work-obj08.cf e~*.lst - rm -f *.vcd - rm -f tb_pic tb_stack + rm -rf $(BUILD) .PHONY: all sim clean diff --git a/PIC/prog_rom.vhd b/PIC/prog_rom.vhd deleted file mode 100644 index f3dcf64..0000000 --- a/PIC/prog_rom.vhd +++ /dev/null @@ -1,1045 +0,0 @@ -library ieee; -use ieee.std_logic_1164.all; -use ieee.numeric_std.all; - -entity prog_rom is - generic ( - DEPTH : positive := 1024 - ); - port ( - addr : in std_logic_vector(12 downto 0); - data : out std_logic_vector(13 downto 0) - ); -end entity prog_rom; - -architecture rtl of prog_rom is - type rom_t is array (0 to 1024 - 1) of std_logic_vector(13 downto 0); - constant rom : rom_t := ( - 0 => "00000000000000", - 1 => "10100000000010", - 2 => "11000001101111", - 3 => "00000010011010", - 4 => "11000000000001", - 5 => "00000010011011", - 6 => "11000010000000", - 7 => "00000000000000", - 8 => "00000000000000", - 9 => "10000100010010", - 10 => "00000000000000", - 11 => "00000000000000", - 12 => "01001010000011", - 13 => "00000000000000", - 14 => "00000010011101", - 15 => "00100000011011", - 16 => "00000010011100", - 17 => "11000001110001", - 18 => "00000010011110", - 19 => "11000000000001", - 20 => "00000010011111", - 21 => "01001010000011", - 22 => "00000000000000", - 23 => "00100000011100", - 24 => "00000010100000", - 25 => "00100000011101", - 26 => "00000010100001", - 27 => "11000011111111", - 28 => "00011110011100", - 29 => "01110000000011", - 30 => "00001110011101", - 31 => "00100000100001", - 32 => "00010000100000", - 33 => "01100100000011", - 34 => "10100010011010", - 35 => "11000000000100", - 36 => "00011100011110", - 37 => "00000010100000", - 38 => "00000110100001", - 39 => "00110110100001", - 40 => "00100000011111", - 41 => "00011110100001", - 42 => "00100000100000", - 43 => "00000010011010", - 44 => "00100000100001", - 45 => "00000010011011", - 46 => "11000010000000", - 47 => "00000000000000", - 48 => "00000000000000", - 49 => "10000100010010", - 50 => "00000000000000", - 51 => "00000000000000", - 52 => "01001010000011", - 53 => "00000000000000", - 54 => "00000010100011", - 55 => "00100000011011", - 56 => "00000010100010", - 57 => "00100000011110", - 58 => "00000010011010", - 59 => "00100000011111", - 60 => "00000010011011", - 61 => "11000010000000", - 62 => "00000000000000", - 63 => "00000000000000", - 64 => "10000100010010", - 65 => "00000000000000", - 66 => "00000000000000", - 67 => "01001010000011", - 68 => "00000000000000", - 69 => "00000010100101", - 70 => "00000010100001", - 71 => "00100000011011", - 72 => "00000010100000", - 73 => "00000010100100", - 74 => "11000000000010", - 75 => "00011100011110", - 76 => "00000010100000", - 77 => "00000110100001", - 78 => "00110110100001", - 79 => "00100000011111", - 80 => "00011110100001", - 81 => "00100000100000", - 82 => "00000010011010", - 83 => "00100000100001", - 84 => "00000010011011", - 85 => "11000010000000", - 86 => "00000000000000", - 87 => "00000000000000", - 88 => "10000100010010", - 89 => "00000000000000", - 90 => "00000000000000", - 91 => "01001010000011", - 92 => "00000000000000", - 93 => "00000010100001", - 94 => "00000010100111", - 95 => "00100000011011", - 96 => "00000010100110", - 97 => "00000010100000", - 98 => "01001010000011", - 99 => "00000000000000", - 100 => "00100000100010", - 101 => "00000010100110", - 102 => "00100000100011", - 103 => "00000010100111", - 104 => "11000011111111", - 105 => "00011110100010", - 106 => "01110000000011", - 107 => "00001110100011", - 108 => "00100000100111", - 109 => "00010000100110", - 110 => "01100100000011", - 111 => "10100010010011", - 112 => "00100000100100", - 113 => "00000010011010", - 114 => "00100000100101", - 115 => "00000010011011", - 116 => "11000010000000", - 117 => "00000000000000", - 118 => "00000000000000", - 119 => "10000100110011", - 120 => "00000000000000", - 121 => "00000000000000", - 122 => "01001010000011", - 123 => "00000000000000", - 124 => "00000010100110", - 125 => "00100000100000", - 126 => "01001010000011", - 127 => "01001100000011", - 128 => "00000010000100", - 129 => "01001110000011", - 130 => "01001010000011", - 131 => "00000000000000", - 132 => "01100000100001", - 133 => "01011110000011", - 134 => "00100000100110", - 135 => "01001010000011", - 136 => "01001100000011", - 137 => "00000010000000", - 138 => "01001010000011", - 139 => "00000000000000", - 140 => "00101010100100", - 141 => "01100100000011", - 142 => "00101010100101", - 143 => "00101010100000", - 144 => "01100100000011", - 145 => "00101010100001", - 146 => "10100001100010", - 147 => "11000000000110", - 148 => "01001010000011", - 149 => "00000000000000", - 150 => "00011110011110", - 151 => "01100000000011", - 152 => "00101010011111", - 153 => "10100000010101", - 154 => "00000000000000", - 155 => "00000000000000", - 156 => "10100010011110", - 157 => "00000000001000", - 158 => "00000110110101", - 159 => "11000000000001", - 160 => "00000010101111", - 161 => "11000001100111", - 162 => "00000010101110", - 163 => "11000010000000", - 164 => "00000010110000", - 165 => "00100000101110", - 166 => "00000010011010", - 167 => "00100000101111", - 168 => "00000010011011", - 169 => "00100000110000", - 170 => "10000101000110", - 171 => "11000001000011", - 172 => "10000101011110", - 173 => "11000000111010", - 174 => "10000101011110", - 175 => "00100000110101", - 176 => "00000010101110", - 177 => "00000110101111", - 178 => "11000011001000", - 179 => "00001000101110", - 180 => "01110000000011", - 181 => "10100011000000", - 182 => "11000000110010", - 183 => "10000101011110", - 184 => "00100000101110", - 185 => "00000010110000", - 186 => "11000000111000", - 187 => "00011100110000", - 188 => "00000010101110", - 189 => "11000000000001", - 190 => "00000010101111", - 191 => "10100011001101", - 192 => "11000001100100", - 193 => "00001000101110", - 194 => "01110000000011", - 195 => "10100011001101", - 196 => "11000000110001", - 197 => "10000101011110", - 198 => "00100000101110", - 199 => "00000010110000", - 200 => "11000010011100", - 201 => "00011100110000", - 202 => "00000010101110", - 203 => "11000000000001", - 204 => "00000010101111", - 205 => "11000000110000", - 206 => "00000010110000", - 207 => "11000000001010", - 208 => "00001000101110", - 209 => "01110000000011", - 210 => "10100011011010", - 211 => "00100000101110", - 212 => "00000010110001", - 213 => "11000011110110", - 214 => "00011100110001", - 215 => "00000010101110", - 216 => "00101010110000", - 217 => "10100011001111", - 218 => "00100000110000", - 219 => "00000010110001", - 220 => "00100000101111", - 221 => "01110100000011", - 222 => "10100011100011", - 223 => "00100000110000", - 224 => "11101000110000", - 225 => "01100100000011", - 226 => "10100011100101", - 227 => "00100000110001", - 228 => "10000101011110", - 229 => "00100000101110", - 230 => "00000010101111", - 231 => "11000000110000", - 232 => "00011100101111", - 233 => "00000010101110", - 234 => "10000101011110", - 235 => "11000000000001", - 236 => "00000010101111", - 237 => "11000001110111", - 238 => "00000010101110", - 239 => "11000010000000", - 240 => "00000010110000", - 241 => "00100000101110", - 242 => "00000010011010", - 243 => "00100000101111", - 244 => "00000010011011", - 245 => "00100000110000", - 246 => "10000101000110", - 247 => "00101010110101", - 248 => "00000110110010", - 249 => "00000110110011", - 250 => "00000110110100", - 251 => "00100000110100", - 252 => "00000010101000", - 253 => "00101000101000", - 254 => "00000010110100", - 255 => "00100000110100", - 256 => "01110100000011", - 257 => "10100011111011", - 258 => "00101000110011", - 259 => "00000010101000", - 260 => "00000010110011", - 261 => "00100000101000", - 262 => "11101000011110", - 263 => "01110100000011", - 264 => "10100011111010", - 265 => "00100000110010", - 266 => "00000010101000", - 267 => "00101000101000", - 268 => "00000010110010", - 269 => "11101001110100", - 270 => "01110100000011", - 271 => "10100011111001", - 272 => "10100010101011", - 273 => "00000000001000", - 274 => "11101000000000", - 275 => "01100100000011", - 276 => "10100100011010", - 277 => "11101010000000", - 278 => "01100100000011", - 279 => "10100100100100", - 280 => "00000110011011", - 281 => "11010000000000", - 282 => "00100000011010", - 283 => "00000010000100", - 284 => "01001110000011", - 285 => "01100000011011", - 286 => "01011110000011", - 287 => "00100000000000", - 288 => "00000010011011", - 289 => "00101010000100", - 290 => "00100000000000", - 291 => "00000000001000", - 292 => "00000000000000", - 293 => "00000000000000", - 294 => "10000101000001", - 295 => "00000010011001", - 296 => "00111110011010", - 297 => "00001110011011", - 298 => "00101010011011", - 299 => "00000000000000", - 300 => "00000000000000", - 301 => "10000101000001", - 302 => "00000010011000", - 303 => "00100000011001", - 304 => "00000010011011", - 305 => "00100000011000", - 306 => "00000000001000", - 307 => "11101000000000", - 308 => "01100100000011", - 309 => "10100100111010", - 310 => "11101010000000", - 311 => "01100100000011", - 312 => "10100101000001", - 313 => "11010000000000", - 314 => "00100000011010", - 315 => "00000010000100", - 316 => "01001110000011", - 317 => "01100000011011", - 318 => "01011110000011", - 319 => "00100000000000", - 320 => "00000000001000", - 321 => "00100000011011", - 322 => "00000010001010", - 323 => "00100000011010", - 324 => "00000010000010", - 325 => "00000000001000", - 326 => "00000010101100", - 327 => "00100000011011", - 328 => "00000010101011", - 329 => "00100000011010", - 330 => "00000010101010", - 331 => "00100000101010", - 332 => "00000010011010", - 333 => "00100000101011", - 334 => "00000010011011", - 335 => "00100000101100", - 336 => "10000100110011", - 337 => "00000010101101", - 338 => "00100000101101", - 339 => "01100100000011", - 340 => "10100101011101", - 341 => "00100000101101", - 342 => "10000101011110", - 343 => "00101010101010", - 344 => "01100100000011", - 345 => "00101010101011", - 346 => "01100100000011", - 347 => "00101010101100", - 348 => "10100101001011", - 349 => "00000000001000", - 350 => "00000010101000", - 351 => "01001010000011", - 352 => "00100001110010", - 353 => "00000010101001", - 354 => "01100000101001", - 355 => "10100101011111", - 356 => "00100000101000", - 357 => "00000011110000", - 358 => "00000000001000", - 359 => "11010001001000", - 360 => "11010001100101", - 361 => "11010001101100", - 362 => "11010001101100", - 363 => "11010001101111", - 364 => "11010000001101", - 365 => "11010000001010", - 366 => "11010000000000", - 367 => "11010000000001", - 368 => "11010000000000", - 369 => "11010001111010", - 370 => "11010000000001", - 371 => "11010000110110", - 372 => "11010000000000", - 373 => "11010000000001", - 374 => "11010000000000", - 375 => "11010000001101", - 376 => "11010000001010", - 377 => "11010000000000", - 378 => "11010000000000", - 379 => "00000000000000", - 380 => "00000000000000", - 381 => "00000000000000", - 382 => "00000000000000", - 383 => "00000000000000", - 384 => "00000000000000", - 385 => "00000000000000", - 386 => "00000000000000", - 387 => "00000000000000", - 388 => "00000000000000", - 389 => "00000000000000", - 390 => "00000000000000", - 391 => "00000000000000", - 392 => "00000000000000", - 393 => "00000000000000", - 394 => "00000000000000", - 395 => "00000000000000", - 396 => "00000000000000", - 397 => "00000000000000", - 398 => "00000000000000", - 399 => "00000000000000", - 400 => "00000000000000", - 401 => "00000000000000", - 402 => "00000000000000", - 403 => "00000000000000", - 404 => "00000000000000", - 405 => "00000000000000", - 406 => "00000000000000", - 407 => "00000000000000", - 408 => "00000000000000", - 409 => "00000000000000", - 410 => "00000000000000", - 411 => "00000000000000", - 412 => "00000000000000", - 413 => "00000000000000", - 414 => "00000000000000", - 415 => "00000000000000", - 416 => "00000000000000", - 417 => "00000000000000", - 418 => "00000000000000", - 419 => "00000000000000", - 420 => "00000000000000", - 421 => "00000000000000", - 422 => "00000000000000", - 423 => "00000000000000", - 424 => "00000000000000", - 425 => "00000000000000", - 426 => "00000000000000", - 427 => "00000000000000", - 428 => "00000000000000", - 429 => "00000000000000", - 430 => "00000000000000", - 431 => "00000000000000", - 432 => "00000000000000", - 433 => "00000000000000", - 434 => "00000000000000", - 435 => "00000000000000", - 436 => "00000000000000", - 437 => "00000000000000", - 438 => "00000000000000", - 439 => "00000000000000", - 440 => "00000000000000", - 441 => "00000000000000", - 442 => "00000000000000", - 443 => "00000000000000", - 444 => "00000000000000", - 445 => "00000000000000", - 446 => "00000000000000", - 447 => "00000000000000", - 448 => "00000000000000", - 449 => "00000000000000", - 450 => "00000000000000", - 451 => "00000000000000", - 452 => "00000000000000", - 453 => "00000000000000", - 454 => "00000000000000", - 455 => "00000000000000", - 456 => "00000000000000", - 457 => "00000000000000", - 458 => "00000000000000", - 459 => "00000000000000", - 460 => "00000000000000", - 461 => "00000000000000", - 462 => "00000000000000", - 463 => "00000000000000", - 464 => "00000000000000", - 465 => "00000000000000", - 466 => "00000000000000", - 467 => "00000000000000", - 468 => "00000000000000", - 469 => "00000000000000", - 470 => "00000000000000", - 471 => "00000000000000", - 472 => "00000000000000", - 473 => "00000000000000", - 474 => "00000000000000", - 475 => "00000000000000", - 476 => "00000000000000", - 477 => "00000000000000", - 478 => "00000000000000", - 479 => "00000000000000", - 480 => "00000000000000", - 481 => "00000000000000", - 482 => "00000000000000", - 483 => "00000000000000", - 484 => "00000000000000", - 485 => "00000000000000", - 486 => "00000000000000", - 487 => "00000000000000", - 488 => "00000000000000", - 489 => "00000000000000", - 490 => "00000000000000", - 491 => "00000000000000", - 492 => "00000000000000", - 493 => "00000000000000", - 494 => "00000000000000", - 495 => "00000000000000", - 496 => "00000000000000", - 497 => "00000000000000", - 498 => "00000000000000", - 499 => "00000000000000", - 500 => "00000000000000", - 501 => "00000000000000", - 502 => "00000000000000", - 503 => "00000000000000", - 504 => "00000000000000", - 505 => "00000000000000", - 506 => "00000000000000", - 507 => "00000000000000", - 508 => "00000000000000", - 509 => "00000000000000", - 510 => "00000000000000", - 511 => "00000000000000", - 512 => "00000000000000", - 513 => "00000000000000", - 514 => "00000000000000", - 515 => "00000000000000", - 516 => "00000000000000", - 517 => "00000000000000", - 518 => "00000000000000", - 519 => "00000000000000", - 520 => "00000000000000", - 521 => "00000000000000", - 522 => "00000000000000", - 523 => "00000000000000", - 524 => "00000000000000", - 525 => "00000000000000", - 526 => "00000000000000", - 527 => "00000000000000", - 528 => "00000000000000", - 529 => "00000000000000", - 530 => "00000000000000", - 531 => "00000000000000", - 532 => "00000000000000", - 533 => "00000000000000", - 534 => "00000000000000", - 535 => "00000000000000", - 536 => "00000000000000", - 537 => "00000000000000", - 538 => "00000000000000", - 539 => "00000000000000", - 540 => "00000000000000", - 541 => "00000000000000", - 542 => "00000000000000", - 543 => "00000000000000", - 544 => "00000000000000", - 545 => "00000000000000", - 546 => "00000000000000", - 547 => "00000000000000", - 548 => "00000000000000", - 549 => "00000000000000", - 550 => "00000000000000", - 551 => "00000000000000", - 552 => "00000000000000", - 553 => "00000000000000", - 554 => "00000000000000", - 555 => "00000000000000", - 556 => "00000000000000", - 557 => "00000000000000", - 558 => "00000000000000", - 559 => "00000000000000", - 560 => "00000000000000", - 561 => "00000000000000", - 562 => "00000000000000", - 563 => "00000000000000", - 564 => "00000000000000", - 565 => "00000000000000", - 566 => "00000000000000", - 567 => "00000000000000", - 568 => "00000000000000", - 569 => "00000000000000", - 570 => "00000000000000", - 571 => "00000000000000", - 572 => "00000000000000", - 573 => "00000000000000", - 574 => "00000000000000", - 575 => "00000000000000", - 576 => "00000000000000", - 577 => "00000000000000", - 578 => "00000000000000", - 579 => "00000000000000", - 580 => "00000000000000", - 581 => "00000000000000", - 582 => "00000000000000", - 583 => "00000000000000", - 584 => "00000000000000", - 585 => "00000000000000", - 586 => "00000000000000", - 587 => "00000000000000", - 588 => "00000000000000", - 589 => "00000000000000", - 590 => "00000000000000", - 591 => "00000000000000", - 592 => "00000000000000", - 593 => "00000000000000", - 594 => "00000000000000", - 595 => "00000000000000", - 596 => "00000000000000", - 597 => "00000000000000", - 598 => "00000000000000", - 599 => "00000000000000", - 600 => "00000000000000", - 601 => "00000000000000", - 602 => "00000000000000", - 603 => "00000000000000", - 604 => "00000000000000", - 605 => "00000000000000", - 606 => "00000000000000", - 607 => "00000000000000", - 608 => "00000000000000", - 609 => "00000000000000", - 610 => "00000000000000", - 611 => "00000000000000", - 612 => "00000000000000", - 613 => "00000000000000", - 614 => "00000000000000", - 615 => "00000000000000", - 616 => "00000000000000", - 617 => "00000000000000", - 618 => "00000000000000", - 619 => "00000000000000", - 620 => "00000000000000", - 621 => "00000000000000", - 622 => "00000000000000", - 623 => "00000000000000", - 624 => "00000000000000", - 625 => "00000000000000", - 626 => "00000000000000", - 627 => "00000000000000", - 628 => "00000000000000", - 629 => "00000000000000", - 630 => "00000000000000", - 631 => "00000000000000", - 632 => "00000000000000", - 633 => "00000000000000", - 634 => "00000000000000", - 635 => "00000000000000", - 636 => "00000000000000", - 637 => "00000000000000", - 638 => "00000000000000", - 639 => "00000000000000", - 640 => "00000000000000", - 641 => "00000000000000", - 642 => "00000000000000", - 643 => "00000000000000", - 644 => "00000000000000", - 645 => "00000000000000", - 646 => "00000000000000", - 647 => "00000000000000", - 648 => "00000000000000", - 649 => "00000000000000", - 650 => "00000000000000", - 651 => "00000000000000", - 652 => "00000000000000", - 653 => "00000000000000", - 654 => "00000000000000", - 655 => "00000000000000", - 656 => "00000000000000", - 657 => "00000000000000", - 658 => "00000000000000", - 659 => "00000000000000", - 660 => "00000000000000", - 661 => "00000000000000", - 662 => "00000000000000", - 663 => "00000000000000", - 664 => "00000000000000", - 665 => "00000000000000", - 666 => "00000000000000", - 667 => "00000000000000", - 668 => "00000000000000", - 669 => "00000000000000", - 670 => "00000000000000", - 671 => "00000000000000", - 672 => "00000000000000", - 673 => "00000000000000", - 674 => "00000000000000", - 675 => "00000000000000", - 676 => "00000000000000", - 677 => "00000000000000", - 678 => "00000000000000", - 679 => "00000000000000", - 680 => "00000000000000", - 681 => "00000000000000", - 682 => "00000000000000", - 683 => "00000000000000", - 684 => "00000000000000", - 685 => "00000000000000", - 686 => "00000000000000", - 687 => "00000000000000", - 688 => "00000000000000", - 689 => "00000000000000", - 690 => "00000000000000", - 691 => "00000000000000", - 692 => "00000000000000", - 693 => "00000000000000", - 694 => "00000000000000", - 695 => "00000000000000", - 696 => "00000000000000", - 697 => "00000000000000", - 698 => "00000000000000", - 699 => "00000000000000", - 700 => "00000000000000", - 701 => "00000000000000", - 702 => "00000000000000", - 703 => "00000000000000", - 704 => "00000000000000", - 705 => "00000000000000", - 706 => "00000000000000", - 707 => "00000000000000", - 708 => "00000000000000", - 709 => "00000000000000", - 710 => "00000000000000", - 711 => "00000000000000", - 712 => "00000000000000", - 713 => "00000000000000", - 714 => "00000000000000", - 715 => "00000000000000", - 716 => "00000000000000", - 717 => "00000000000000", - 718 => "00000000000000", - 719 => "00000000000000", - 720 => "00000000000000", - 721 => "00000000000000", - 722 => "00000000000000", - 723 => "00000000000000", - 724 => "00000000000000", - 725 => "00000000000000", - 726 => "00000000000000", - 727 => "00000000000000", - 728 => "00000000000000", - 729 => "00000000000000", - 730 => "00000000000000", - 731 => "00000000000000", - 732 => "00000000000000", - 733 => "00000000000000", - 734 => "00000000000000", - 735 => "00000000000000", - 736 => "00000000000000", - 737 => "00000000000000", - 738 => "00000000000000", - 739 => "00000000000000", - 740 => "00000000000000", - 741 => "00000000000000", - 742 => "00000000000000", - 743 => "00000000000000", - 744 => "00000000000000", - 745 => "00000000000000", - 746 => "00000000000000", - 747 => "00000000000000", - 748 => "00000000000000", - 749 => "00000000000000", - 750 => "00000000000000", - 751 => "00000000000000", - 752 => "00000000000000", - 753 => "00000000000000", - 754 => "00000000000000", - 755 => "00000000000000", - 756 => "00000000000000", - 757 => "00000000000000", - 758 => "00000000000000", - 759 => "00000000000000", - 760 => "00000000000000", - 761 => "00000000000000", - 762 => "00000000000000", - 763 => "00000000000000", - 764 => "00000000000000", - 765 => "00000000000000", - 766 => "00000000000000", - 767 => "00000000000000", - 768 => "00000000000000", - 769 => "00000000000000", - 770 => "00000000000000", - 771 => "00000000000000", - 772 => "00000000000000", - 773 => "00000000000000", - 774 => "00000000000000", - 775 => "00000000000000", - 776 => "00000000000000", - 777 => "00000000000000", - 778 => "00000000000000", - 779 => "00000000000000", - 780 => "00000000000000", - 781 => "00000000000000", - 782 => "00000000000000", - 783 => "00000000000000", - 784 => "00000000000000", - 785 => "00000000000000", - 786 => "00000000000000", - 787 => "00000000000000", - 788 => "00000000000000", - 789 => "00000000000000", - 790 => "00000000000000", - 791 => "00000000000000", - 792 => "00000000000000", - 793 => "00000000000000", - 794 => "00000000000000", - 795 => "00000000000000", - 796 => "00000000000000", - 797 => "00000000000000", - 798 => "00000000000000", - 799 => "00000000000000", - 800 => "00000000000000", - 801 => "00000000000000", - 802 => "00000000000000", - 803 => "00000000000000", - 804 => "00000000000000", - 805 => "00000000000000", - 806 => "00000000000000", - 807 => "00000000000000", - 808 => "00000000000000", - 809 => "00000000000000", - 810 => "00000000000000", - 811 => "00000000000000", - 812 => "00000000000000", - 813 => "00000000000000", - 814 => "00000000000000", - 815 => "00000000000000", - 816 => "00000000000000", - 817 => "00000000000000", - 818 => "00000000000000", - 819 => "00000000000000", - 820 => "00000000000000", - 821 => "00000000000000", - 822 => "00000000000000", - 823 => "00000000000000", - 824 => "00000000000000", - 825 => "00000000000000", - 826 => "00000000000000", - 827 => "00000000000000", - 828 => "00000000000000", - 829 => "00000000000000", - 830 => "00000000000000", - 831 => "00000000000000", - 832 => "00000000000000", - 833 => "00000000000000", - 834 => "00000000000000", - 835 => "00000000000000", - 836 => "00000000000000", - 837 => "00000000000000", - 838 => "00000000000000", - 839 => "00000000000000", - 840 => "00000000000000", - 841 => "00000000000000", - 842 => "00000000000000", - 843 => "00000000000000", - 844 => "00000000000000", - 845 => "00000000000000", - 846 => "00000000000000", - 847 => "00000000000000", - 848 => "00000000000000", - 849 => "00000000000000", - 850 => "00000000000000", - 851 => "00000000000000", - 852 => "00000000000000", - 853 => "00000000000000", - 854 => "00000000000000", - 855 => "00000000000000", - 856 => "00000000000000", - 857 => "00000000000000", - 858 => "00000000000000", - 859 => "00000000000000", - 860 => "00000000000000", - 861 => "00000000000000", - 862 => "00000000000000", - 863 => "00000000000000", - 864 => "00000000000000", - 865 => "00000000000000", - 866 => "00000000000000", - 867 => "00000000000000", - 868 => "00000000000000", - 869 => "00000000000000", - 870 => "00000000000000", - 871 => "00000000000000", - 872 => "00000000000000", - 873 => "00000000000000", - 874 => "00000000000000", - 875 => "00000000000000", - 876 => "00000000000000", - 877 => "00000000000000", - 878 => "00000000000000", - 879 => "00000000000000", - 880 => "00000000000000", - 881 => "00000000000000", - 882 => "00000000000000", - 883 => "00000000000000", - 884 => "00000000000000", - 885 => "00000000000000", - 886 => "00000000000000", - 887 => "00000000000000", - 888 => "00000000000000", - 889 => "00000000000000", - 890 => "00000000000000", - 891 => "00000000000000", - 892 => "00000000000000", - 893 => "00000000000000", - 894 => "00000000000000", - 895 => "00000000000000", - 896 => "00000000000000", - 897 => "00000000000000", - 898 => "00000000000000", - 899 => "00000000000000", - 900 => "00000000000000", - 901 => "00000000000000", - 902 => "00000000000000", - 903 => "00000000000000", - 904 => "00000000000000", - 905 => "00000000000000", - 906 => "00000000000000", - 907 => "00000000000000", - 908 => "00000000000000", - 909 => "00000000000000", - 910 => "00000000000000", - 911 => "00000000000000", - 912 => "00000000000000", - 913 => "00000000000000", - 914 => "00000000000000", - 915 => "00000000000000", - 916 => "00000000000000", - 917 => "00000000000000", - 918 => "00000000000000", - 919 => "00000000000000", - 920 => "00000000000000", - 921 => "00000000000000", - 922 => "00000000000000", - 923 => "00000000000000", - 924 => "00000000000000", - 925 => "00000000000000", - 926 => "00000000000000", - 927 => "00000000000000", - 928 => "00000000000000", - 929 => "00000000000000", - 930 => "00000000000000", - 931 => "00000000000000", - 932 => "00000000000000", - 933 => "00000000000000", - 934 => "00000000000000", - 935 => "00000000000000", - 936 => "00000000000000", - 937 => "00000000000000", - 938 => "00000000000000", - 939 => "00000000000000", - 940 => "00000000000000", - 941 => "00000000000000", - 942 => "00000000000000", - 943 => "00000000000000", - 944 => "00000000000000", - 945 => "00000000000000", - 946 => "00000000000000", - 947 => "00000000000000", - 948 => "00000000000000", - 949 => "00000000000000", - 950 => "00000000000000", - 951 => "00000000000000", - 952 => "00000000000000", - 953 => "00000000000000", - 954 => "00000000000000", - 955 => "00000000000000", - 956 => "00000000000000", - 957 => "00000000000000", - 958 => "00000000000000", - 959 => "00000000000000", - 960 => "00000000000000", - 961 => "00000000000000", - 962 => "00000000000000", - 963 => "00000000000000", - 964 => "00000000000000", - 965 => "00000000000000", - 966 => "00000000000000", - 967 => "00000000000000", - 968 => "00000000000000", - 969 => "00000000000000", - 970 => "00000000000000", - 971 => "00000000000000", - 972 => "00000000000000", - 973 => "00000000000000", - 974 => "00000000000000", - 975 => "00000000000000", - 976 => "00000000000000", - 977 => "00000000000000", - 978 => "00000000000000", - 979 => "00000000000000", - 980 => "00000000000000", - 981 => "00000000000000", - 982 => "00000000000000", - 983 => "00000000000000", - 984 => "00000000000000", - 985 => "00000000000000", - 986 => "00000000000000", - 987 => "00000000000000", - 988 => "00000000000000", - 989 => "00000000000000", - 990 => "00000000000000", - 991 => "00000000000000", - 992 => "00000000000000", - 993 => "00000000000000", - 994 => "00000000000000", - 995 => "00000000000000", - 996 => "00000000000000", - 997 => "00000000000000", - 998 => "00000000000000", - 999 => "00000000000000", - 1000 => "00000000000000", - 1001 => "00000000000000", - 1002 => "00000000000000", - 1003 => "00000000000000", - 1004 => "00000000000000", - 1005 => "00000000000000", - 1006 => "00000000000000", - 1007 => "00000000000000", - 1008 => "00000000000000", - 1009 => "00000000000000", - 1010 => "00000000000000", - 1011 => "00000000000000", - 1012 => "00000000000000", - 1013 => "00000000000000", - 1014 => "00000000000000", - 1015 => "00000000000000", - 1016 => "00000000000000", - 1017 => "00000000000000", - 1018 => "00000000000000", - 1019 => "00000000000000", - 1020 => "00000000000000", - 1021 => "00000000000000", - 1022 => "00000000000000", - 1023 => "00000000000000" - ); -begin - data <= rom(to_integer(unsigned(addr(9 downto 0)))); -end architecture rtl; diff --git a/fw/fib.c b/fw/fib.c new file mode 100644 index 0000000..2ba9535 --- /dev/null +++ b/fw/fib.c @@ -0,0 +1,84 @@ +#include <pic16f84a.h> + +typedef unsigned char uint8_t; + +__sfr __at(0x70) UART_TX; +__sfr __at(0x71) UART_RX; +__sfr __at(0x72) UART_STATUS; + +static volatile uint8_t _d0, _d1, _d2; + +// Custom delay to make the output readable at 50MHz +static void delay(void) { + _d0 = 0; + do { + _d1 = 0; + do { + _d2 = 0; + do { _d2++; } while (_d2 != 0); + } while (++_d1 != 50); // Increased for 50MHz visibility + _d0++; + } while (_d0 != 20); +} + +static void uart_send(uint8_t byte) { + while (UART_STATUS & 0x01); + UART_TX = byte; +} + +static void uart_puts_rom(const char *s) { + while (*s) { + uart_send((uint8_t)*s); + s++; + } +} + +// Simple BCD printer for 8-bit numbers +void print_uint8(uint8_t v) { + uint8_t started = 0; + + // Hundreds + if (v >= 200) { uart_send('2'); v -= 200; started = 1; } + else if (v >= 100) { uart_send('1'); v -= 100; started = 1; } + + // Tens + uint8_t tens = '0'; + while (v >= 10) { v -= 10; tens++; } + if (started || tens != '0') { uart_send(tens); } + + // Units + uart_send(v + '0'); +} + +void main(void) { + uint8_t a, b, next; + + uart_puts_rom("\x1B[2J\x1B[H"); // Clear screen, Home cursor + uart_puts_rom("PIC16F84A @ 50MHz Fibonacci\r\n"); + uart_puts_rom("---------------------------\r\n"); + + while (1) { + a = 0; + b = 1; + + while (a <= 233) { // Max 8-bit Fib is 233 + print_uint8(a); + uart_puts_rom(", "); + + next = a + b; + a = b; + b = next; + + delay(); + + // Break before overflow + if (a == 233) { + print_uint8(a); + break; + } + } + + uart_puts_rom("\r\nRestarting...\r\n"); + delay(); + } +} diff --git a/PIC/test_uart.c b/fw/test_uart.c index 2656371..4e18dc5 100644 --- a/PIC/test_uart.c +++ b/fw/test_uart.c @@ -18,7 +18,7 @@ static void delay(void) { do { _d2++; } while (_d2 != 0); } while (++_d1 != 30); _d0++; - } while (_d0 != 116); + } while (_d0 != 10); } static void uart_send(uint8_t byte) { @@ -36,12 +36,16 @@ static void uart_puts_rom(const char *s) { void main(void) { counter = 0; - uart_puts_rom("Hello\r\n"); + uart_puts_rom("counter\r\n"); while (1) { uint8_t v = counter; uint8_t started = 0; + + uart_puts_rom("\r"); + uart_puts_rom("\x1B[K"); + uart_send('C'); uart_send(':'); @@ -59,8 +63,6 @@ void main(void) { // Units (always) uart_send(v + '0'); - uart_puts_rom("\r\n"); - counter++; delay(); } diff --git a/PIC/ALU.vhd b/hdl/ALU.vhd index b7c0344..b7c0344 100644 --- a/PIC/ALU.vhd +++ b/hdl/ALU.vhd diff --git a/PIC/PIC.vhd b/hdl/PIC.vhd index a31bec7..a31bec7 100644 --- a/PIC/PIC.vhd +++ b/hdl/PIC.vhd diff --git a/PIC/common.vhd b/hdl/common.vhd index c986ec5..c986ec5 100644 --- a/PIC/common.vhd +++ b/hdl/common.vhd diff --git a/PIC/decoder.vhd b/hdl/decoder.vhd index 5a1eb2c..5a1eb2c 100644 --- a/PIC/decoder.vhd +++ b/hdl/decoder.vhd diff --git a/PIC/dpram.vhd b/hdl/dpram.vhd index 44d7adf..44d7adf 100644 --- a/PIC/dpram.vhd +++ b/hdl/dpram.vhd diff --git a/PIC/fifo.vhd b/hdl/fifo.vhd index 9dd8523..9dd8523 100644 --- a/PIC/fifo.vhd +++ b/hdl/fifo.vhd diff --git a/PIC/hdl-prj.json b/hdl/hdl-prj.json index b557c2b..b557c2b 100644 --- a/PIC/hdl-prj.json +++ b/hdl/hdl-prj.json diff --git a/PIC/hexfile_reader.vhd b/hdl/hexfile_reader.vhd index 143a264..143a264 100644 --- a/PIC/hexfile_reader.vhd +++ b/hdl/hexfile_reader.vhd diff --git a/PIC/pic_top.vhd b/hdl/pic_top.vhd index f0cb4bd..f0cb4bd 100644 --- a/PIC/pic_top.vhd +++ b/hdl/pic_top.vhd diff --git a/PIC/stack.vhd b/hdl/stack.vhd index fd376c0..fd376c0 100644 --- a/PIC/stack.vhd +++ b/hdl/stack.vhd diff --git a/PIC/state_machine.vhd b/hdl/state_machine.vhd index 24da581..5b1c623 100644 --- a/PIC/state_machine.vhd +++ b/hdl/state_machine.vhd @@ -210,6 +210,14 @@ begin if not is_phantom then we_status <= '1'; + -- branch instructions complete over 2 cycles; pulse instr_ret only + -- on the phantom NOP cycle (below), not here + if instr.op /= GOTO and instr.op /= CALL and + instr.op /= RETUR and instr.op /= RETLW then + instr_ret <= '1'; + end if; + elsif not is_skip_phantom then + -- branch phantom NOP: this is the true end of the 2-cycle instruction instr_ret <= '1'; end if; state <= IFetch; diff --git a/PIC/tb_pic.vhd b/hdl/tb_pic.vhd index 067e154..6e82ae2 100644 --- a/PIC/tb_pic.vhd +++ b/hdl/tb_pic.vhd @@ -8,7 +8,7 @@ end entity tb_pic; architecture behavioural of tb_pic is constant T_clk : time := 20 ns; -- 50M - constant HEX_FILE : string := "program.hex"; + constant HEX_FILE : string := "build/program.hex"; constant SIM_CYCLES : integer := 800_000; signal clk : std_logic := '0'; diff --git a/PIC/tb_stack.vhd b/hdl/tb_stack.vhd index 5b386e9..5b386e9 100644 --- a/PIC/tb_stack.vhd +++ b/hdl/tb_stack.vhd diff --git a/PIC/uart.vhd b/hdl/uart.vhd index a0fad93..a0fad93 100644 --- a/PIC/uart.vhd +++ b/hdl/uart.vhd diff --git a/test_uart.c b/test_uart.c deleted file mode 100644 index e69de29..0000000 --- a/test_uart.c +++ /dev/null diff --git a/test_uart.hex b/test_uart.hex deleted file mode 100644 index 70d8c2f..0000000 --- a/test_uart.hex +++ /dev/null @@ -1,50 +0,0 @@ -:020000040000FA -:10000000000002286F309A0001309B008030000011 -:100010000000122100000000831200009D001B0858 -:100020009C0071309E0001309F00831200001C086C -:10003000A0001D08A100FF309C07031C9D032108A0 -:10004000200403199A2804301E07A000A101A10D65 -:100050001F08A10720089A0021089B00803000009B -:10006000000012210000000083120000A3001B0802 -:10007000A2001E089A001F089B00803000000000AC -:1000800012210000000083120000A500A1001B083F -:10009000A000A40002301E07A000A101A10D1F08AE -:1000A000A10720089A0021089B0080300000000072 -:1000B00012210000000083120000A100A7001B080D -:1000C000A600A000831200002208A6002308A700B3 -:1000D000FF30A207031CA303270826040319932853 -:1000E00024089A0025089B0080300000000033217E -:1000F0000000000083120000A600200883120313F2 -:1001000084008313831200002118831726088312AA -:100110000313800083120000A40A0319A50AA00A91 -:100120000319A10A62280630831200009E070318F3 -:100130009F0A1528000000009E280800B501013024 -:10014000AF006730AE008030B0002E089A002F0854 -:100150009B00300846213508AE00AF0143305E21D8 -:100160003A305E21C8302E02031CC02832305E2196 -:100170002E08B00038303007AE000130AF00CD2877 -:1001800064302E02031CCD2831305E212E08B000D1 -:100190009C303007AE000130AF003030B0000A3084 -:1001A0002E02031CDA282E08B100F6303107AE000B -:1001B000B00ACF283008B1002F08031DE32830080B -:1001C000303A0319E52831085E212E08AF0030309F -:1001D0002F07AE005E210130AF007730AE008030D7 -:1001E000B0002E089A002F089B0030084621B50A5F -:1001F000B201B301B4013408A800280AB4003408DD -:10020000031DFB28330AA800B30028081E3A031D6B -:10021000FA283208A800280AB200743A031DF92807 -:10022000AB280800003A03191A29803A0319242937 -:100230009B0100341A08840083131B1883170008DD -:100240009B00840A0008080000000000412199007A -:100250009A0F9B039B0A0000000041219800190897 -:100260009B0018080800003A03193A29803A03193C -:10027000412900341A08840083131B1883170008CF -:1002800008001B088A001A0882000800AC001B083E -:10029000AB001A08AA002A089A002B089B002C0819 -:1002A0003321AD002D0803195D292D085E21AA0A0E -:1002B0000319AB0A0319AC0A4B290800A8008312E2 -:1002C0007208A90029185F292808F000080048349E -:1002D00065346C346C346F340D340A3400340134BA -:1002E00000347A34013436340034013400340D34AF -:0602F0000A340034003462 -:00000001FF |
