aboutsummaryrefslogtreecommitdiff
path: root/basys3/basys3.srcs/ppu_two_lut.vhd
diff options
context:
space:
mode:
Diffstat (limited to 'basys3/basys3.srcs/ppu_two_lut.vhd')
-rw-r--r--basys3/basys3.srcs/ppu_two_lut.vhd65
1 files changed, 65 insertions, 0 deletions
diff --git a/basys3/basys3.srcs/ppu_two_lut.vhd b/basys3/basys3.srcs/ppu_two_lut.vhd
new file mode 100644
index 0000000..92c18a1
--- /dev/null
+++ b/basys3/basys3.srcs/ppu_two_lut.vhd
@@ -0,0 +1,65 @@
+library ieee;
+use ieee.std_logic_1164.all;
+
+entity ppu_two_lut is port( -- PPU tilemap word offset LUT (divide 8-bit number by 5)
+ pidx : in integer range 0 to 255; -- dividend
+ two : out integer range 0 to 255); -- result
+end ppu_two_lut;
+
+architecture Behavioral of ppu_two_lut is
+begin
+ with pidx select two <=
+ 0 when 0 | 1 | 2 | 3 | 4,
+ 1 when 5 | 6 | 7 | 8 | 9,
+ 2 when 10 | 11 | 12 | 13 | 14,
+ 3 when 15 | 16 | 17 | 18 | 19,
+ 4 when 20 | 21 | 22 | 23 | 24,
+ 5 when 25 | 26 | 27 | 28 | 29,
+ 6 when 30 | 31 | 32 | 33 | 34,
+ 7 when 35 | 36 | 37 | 38 | 39,
+ 8 when 40 | 41 | 42 | 43 | 44,
+ 9 when 45 | 46 | 47 | 48 | 49,
+ 10 when 50 | 51 | 52 | 53 | 54,
+ 11 when 55 | 56 | 57 | 58 | 59,
+ 12 when 60 | 61 | 62 | 63 | 64,
+ 13 when 65 | 66 | 67 | 68 | 69,
+ 14 when 70 | 71 | 72 | 73 | 74,
+ 15 when 75 | 76 | 77 | 78 | 79,
+ 16 when 80 | 81 | 82 | 83 | 84,
+ 17 when 85 | 86 | 87 | 88 | 89,
+ 18 when 90 | 91 | 92 | 93 | 94,
+ 19 when 95 | 96 | 97 | 98 | 99,
+ 20 when 100 | 101 | 102 | 103 | 104,
+ 21 when 105 | 106 | 107 | 108 | 109,
+ 22 when 110 | 111 | 112 | 113 | 114,
+ 23 when 115 | 116 | 117 | 118 | 119,
+ 24 when 120 | 121 | 122 | 123 | 124,
+ 25 when 125 | 126 | 127 | 128 | 129,
+ 26 when 130 | 131 | 132 | 133 | 134,
+ 27 when 135 | 136 | 137 | 138 | 139,
+ 28 when 140 | 141 | 142 | 143 | 144,
+ 29 when 145 | 146 | 147 | 148 | 149,
+ 30 when 150 | 151 | 152 | 153 | 154,
+ 31 when 155 | 156 | 157 | 158 | 159,
+ 32 when 160 | 161 | 162 | 163 | 164,
+ 33 when 165 | 166 | 167 | 168 | 169,
+ 34 when 170 | 171 | 172 | 173 | 174,
+ 35 when 175 | 176 | 177 | 178 | 179,
+ 36 when 180 | 181 | 182 | 183 | 184,
+ 37 when 185 | 186 | 187 | 188 | 189,
+ 38 when 190 | 191 | 192 | 193 | 194,
+ 39 when 195 | 196 | 197 | 198 | 199,
+ 40 when 200 | 201 | 202 | 203 | 204,
+ 41 when 205 | 206 | 207 | 208 | 209,
+ 42 when 210 | 211 | 212 | 213 | 214,
+ 43 when 215 | 216 | 217 | 218 | 219,
+ 44 when 220 | 221 | 222 | 223 | 224,
+ 45 when 225 | 226 | 227 | 228 | 229,
+ 46 when 230 | 231 | 232 | 233 | 234,
+ 47 when 235 | 236 | 237 | 238 | 239,
+ 48 when 240 | 241 | 242 | 243 | 244,
+ 49 when 245 | 246 | 247 | 248 | 249,
+ 50 when 250 | 251 | 252 | 253 | 254,
+ 51 when 255,
+ 0 when others;
+end Behavioral;