From 0554f2547d832bffd7a78297a7a7b889375d96fd Mon Sep 17 00:00:00 2001 From: yannickreiss Date: Mon, 4 Mar 2024 15:59:13 +0100 Subject: [PATCH] Finished ALU --- Makefile | 4 ++-- tb_alu.vhdl | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 7d70739..790579b 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ CHDL = ghdl FLAGS = --std=08 STOP = 60000ns -PARTS = alu +PARTS = alu stack all: $(PARTS) @@ -15,4 +15,4 @@ clean: find . -name '*.cf' -exec rm -r {} \; find . -name '*.ghw' -exec rm -r {} \; find . -name '*.entity' -exec rm -r {} \; - find . -name $(PARTS)_tb -exec rm -r {} \; + find . -name '*_tb' -exec rm -r {} \; diff --git a/tb_alu.vhdl b/tb_alu.vhdl index 640c030..459db91 100644 --- a/tb_alu.vhdl +++ b/tb_alu.vhdl @@ -59,7 +59,7 @@ begin target <= operand1 xor "11111111"; wait for 5 ns; if not (target = result) then - write(lineBuffer, string'("Error on Not")); + write(lineBuffer, string'("=> Error on Not")); writeline(output, lineBuffer); end if; @@ -69,7 +69,7 @@ begin target <= "00000000"; wait for 5 ns; if not (unsigned(result) = unsigned(target)) then - write(lineBuffer, string'("Error on Parity")); + write(lineBuffer, string'("=> Error on Parity")); writeline(output, lineBuffer); end if; @@ -79,7 +79,7 @@ begin target <= "00000010"; wait for 5 ns; if not (unsigned(result) = 1) then - write(lineBuffer, string'("Error on Count")); + write(lineBuffer, string'("=> Error on Count")); writeline(output, lineBuffer); end if; @@ -89,7 +89,7 @@ begin target <= operand1 and operand2; wait for 5 ns; if not (result = target) then - write(lineBuffer, string'("Error on And")); + write(lineBuffer, string'("=> Error on And")); writeline(output, lineBuffer); end if; @@ -98,7 +98,7 @@ begin operator <= "010001"; wait for 5 ns; if not (result = (operand1 or operand2)) then - write(lineBuffer, string'("Error on Or")); + write(lineBuffer, string'("=> Error on Or")); writeline(output, lineBuffer); end if; @@ -107,7 +107,7 @@ begin operator <= "010101"; wait for 5 ns; if not (result = (operand1 xor operand2)) then - write(lineBuffer, string'("Error on Xor")); + write(lineBuffer, string'("=> Error on Xor")); writeline(output, lineBuffer); end if; @@ -116,7 +116,7 @@ begin operator <= "011001"; wait for 5 ns; if not (result = operand2) then - write(lineBuffer, string'("Error on Move")); + write(lineBuffer, string'("=> Error on Move")); writeline(output, lineBuffer); end if; @@ -125,7 +125,7 @@ begin operator <= "011101"; wait for 5 ns; if not (result = std_logic_vector(to_stdlogicvector(to_bitvector(operand1) sll to_integer(unsigned(operand2))))) then - write(lineBuffer, string'("Error on Shift left")); + write(lineBuffer, string'("=> Error on Shift left")); writeline(output, lineBuffer); end if; @@ -134,7 +134,7 @@ begin operator <= "100001"; wait for 5 ns; if not (result = std_logic_vector(to_stdlogicvector(to_bitvector(operand1) srl to_integer(unsigned(operand2))))) then - write(lineBuffer, string'("Error on Shift right")); + write(lineBuffer, string'("=> Error on Shift right")); writeline(output, lineBuffer); end if; @@ -143,7 +143,7 @@ begin operator <= "000010"; wait for 5 ns; if not (result = std_logic_vector(unsigned(operand1) + unsigned(operand2))) then - write(lineBuffer, string'("Error on Add")); + write(lineBuffer, string'("=> Error on Add")); writeline(output, lineBuffer); end if; @@ -152,7 +152,7 @@ begin operator <= "000110"; wait for 5 ns; if not (result = std_logic_vector(signed(operand1) - signed(operand2))) then - write(lineBuffer, string'("Error on Sub")); + write(lineBuffer, string'("=> Error on Sub")); writeline(output, lineBuffer); end if; @@ -161,7 +161,7 @@ begin operator <= "000011"; wait for 5 ns; if not (result = "00000000") then - write(lineBuffer, string'("Error on Set if Equal")); + write(lineBuffer, string'("=> Error on Set if Equal")); writeline(output, lineBuffer); end if; @@ -170,7 +170,7 @@ begin operator <= "000111"; wait for 5 ns; if not (result = "00000001") then - write(lineBuffer, string'("Error on Set if Lower")); + write(lineBuffer, string'("=> Error on Set if Lower")); writeline(output, lineBuffer); end if; @@ -179,7 +179,7 @@ begin operator <= "001011"; wait for 5 ns; if not (result = "00000001") then - write(lineBuffer, string'("Error on Set if lower unsigned")); + write(lineBuffer, string'("=> Error on Set if lower unsigned")); writeline(output, lineBuffer); end if;