Hardware Design: SIE
Sign in or create your account | Project List | Help
Hardware Design: SIE Commit Details
| Date: | 2010-10-12 17:21:30 (2 years 8 months ago) |
|---|---|
| Author: | César Pedraza |
| Commit: | 5fbd9db02f9bc966892cf290383d940e7e990da4 |
| Message: | fixed logic for Evalfit peripheral |
| Files: |
Examples/ehw4/logic/evalfit_peripheral.vhd (15 diffs) Examples/ehw4/logic/reg_bank.v (3 diffs) |
Change Details
| Examples/ehw4/logic/evalfit_peripheral.vhd | ||
|---|---|---|
| 3 | 3 | -- Evalua un arbol de 5 pentarboles, por ahora es valido hasta para *** 14 variables *** |
| 4 | 4 | -- Funciona hasta con 14 vars. |
| 5 | 5 | -- mapa: |
| 6 | -- 0 - 0x3F Cromosoma | |
| 6 | -- 0 - 0x3F Cromosoma (cada uno con 64-bit) | |
| 7 | 7 | -- 0x40 - 0x13F Objetivo. 16384 bits. Se empieza por el bit 0 MSB. |
| 8 | 8 | |
| 9 | 9 | |
| 10 | -- bit bit Contenido | |
| 10 | -- Mapa de cromosoma: | |
| 11 | -- bit bit Contenido | |
| 11 | 12 | -- 28 a 31 Nivel del arbol |
| 12 | -- 32 a 47 LUT o tabla del arbol | |
| 13 | -- 48 a 63 Variables de entrada del arbol (4 bits por variable) | |
| 13 | -- 32 a 47 LUT o tabla del arbol LUT(32)MSB, LUT(47)LSB, | |
| 14 | -- 48 a 63 Variables de entrada del arbol (4 bits por variable) 48-51 MSB, 60-63 LSB | |
| 14 | 15 | |
| 15 | 16 | library IEEE; |
| 16 | 17 | use IEEE.STD_LOGIC_1164.ALL; |
| ... | ... | |
| 25 | 25 | Port ( clk, reset, habilita: in STD_LOGIC; |
| 26 | 26 | maxcombs : in STD_LOGIC_VECTOR (0 to 15); |
| 27 | 27 | nivel_max : in STD_LOGIC_VECTOR (0 to 3); |
| 28 | peripheral_mem_in : in STD_LOGIC_VECTOR (0 to 63); | |
| 29 | peripheral_mem_en : out std_logic; | |
| 30 | peripheral_mem_out : out STD_LOGIC_VECTOR (0 to 63); | |
| 31 | peripheral_mem_we : out STD_LOGIC; | |
| 32 | peripheral_mem_addr : out STD_LOGIC_VECTOR (0 to 8); | |
| 33 | evalfit3_estado : out std_logic_vector(0 to 7); | |
| 28 | peripheral_mem_in : in STD_LOGIC_VECTOR (0 to 63); | |
| 29 | peripheral_mem_en : out std_logic; | |
| 30 | peripheral_mem_out: out STD_LOGIC_VECTOR (0 to 63); | |
| 31 | peripheral_mem_we : out STD_LOGIC; | |
| 32 | peripheral_mem_addr: out STD_LOGIC_VECTOR (0 to 8); | |
| 33 | evalfit3_estado : out std_logic_vector(0 to 15); | |
| 34 | 34 | errores : out STD_LOGIC_VECTOR (0 to 15); |
| 35 | 35 | fin_ack : out std_logic; |
| 36 | 36 | reg0_s : out STD_LOGIC_VECTOR (0 to 31); |
| ... | ... | |
| 54 | 54 | when "0101" => return ent(10); |
| 55 | 55 | when "0110" => return ent(9); |
| 56 | 56 | when "0111" => return ent(8); |
| 57 | when "1000" => return ent(7); | |
| 57 | when "1000" => return ent(7); | |
| 58 | 58 | when "1001" => return ent(6); |
| 59 | 59 | when "1010" => return ent(5); |
| 60 | 60 | when "1011" => return ent(4); |
| ... | ... | |
| 95 | 95 | signal nivel, nivel_sig, nivel_reg: std_logic_vector(0 to 3); |
| 96 | 96 | signal c1, c1_sig, c2, c2_sig, c3, c3_sig, c4, c4_sig: std_logic_vector(0 to 1); |
| 97 | 97 | signal conta, conta_sig, conta2, conta2_sig: std_logic_vector(0 to 15); |
| 98 | signal estado_evalf3, estado_evalf3_sig: std_logic_vector(0 to 7); | |
| 98 | signal estado_evalf3, estado_evalf3_sig: std_logic_vector(0 to 15); | |
| 99 | 99 | signal peripheral_mem_addr_aux, peripheral_mem_addr_sig, peripheral_mem_addr_crom_sig,peripheral_mem_addr_crom : STD_LOGIC_VECTOR (0 to 8); |
| 100 | 100 | |
| 101 | 101 | begin |
| ... | ... | |
| 132 | 132 | peripheral_mem_en <= '0'; |
| 133 | 133 | errores_sig <= errores_aux; |
| 134 | 134 | nivel_sig <= nivel_reg; |
| 135 | estado_evalf3_sig <= x"FF"; | |
| 135 | estado_evalf3_sig <= x"FFFF"; | |
| 136 | 136 | case ep is |
| 137 | 137 | when reset1 => --poner la memoria a 0000 |
| 138 | 138 | WE_n2_sig <= "1111"; |
| 139 | 139 | WE_n3_sig <= "1111"; |
| 140 | 140 | WE_n4_sig <= "1111"; |
| 141 | 141 | conta2_sig <= (others => '0'); |
| 142 | estado_evalf3_sig <= x"0001"; | |
| 142 | 143 | es <= reset2; |
| 143 | 144 | when reset2 => |
| 144 | 145 | DI_n2 <= "0000"; |
| 145 | 146 | DI_n3 <= "0000"; |
| 146 | 147 | DI_n4 <= "0000"; |
| 148 | estado_evalf3_sig <= x"0002"; | |
| 147 | 149 | if(conta2 = maxcombs)then |
| 148 | 150 | WE_n2_sig <= "0000"; |
| 149 | 151 | WE_n3_sig <= "0000"; |
| ... | ... | |
| 173 | 175 | es <= proceso; |
| 174 | 176 | peripheral_mem_en <= '1'; |
| 175 | 177 | end if; |
| 176 | estado_evalf3_sig <= x"01"; | |
| 178 | estado_evalf3_sig <= x"0003"; | |
| 177 | 179 | |
| 178 | 180 | when proceso => |
| 179 | 181 | peripheral_mem_en <= '1'; |
| ... | ... | |
| 206 | 208 | peripheral_mem_addr_sig <= peripheral_mem_addr_aux + 1; |
| 207 | 209 | peripheral_mem_addr_crom_sig <= peripheral_mem_addr_aux + 1; |
| 208 | 210 | nivel_sig <= nivel; |
| 209 | estado_evalf3_sig <= x"02"; | |
| 211 | estado_evalf3_sig <= peripheral_mem_in(48 to 63);--x"FFE" & nivel;----x"02"; | |
| 210 | 212 | |
| 211 | 213 | when n1 => |
| 212 | 214 | peripheral_mem_en <= '1'; |
| 213 | 215 | c1_sig <= c1 + 1; |
| 214 | 216 | peripheral_mem_addr_sig <= peripheral_mem_addr_aux; |
| 215 | 217 | es <= proceso; |
| 216 | estado_evalf3_sig <= x"03"; | |
| 218 | estado_evalf3_sig <= x"0004"; | |
| 217 | 219 | |
| 218 | 220 | when n2 => |
| 219 | 221 | WE_n2_sig(conv_integer(c2)) <= '1'; |
| ... | ... | |
| 222 | 224 | peripheral_mem_addr_sig <= "001000000" + ('0' & conta(2 to 9));-- esto es para que evalue el pentarbol y guarde en memoria la salida |
| 223 | 225 | es <= precuenta; |
| 224 | 226 | conta2_sig <= (others => '0'); |
| 225 | estado_evalf3_sig <= x"04"; | |
| 227 | estado_evalf3_sig <= x"0005"; | |
| 226 | 228 | |
| 227 | 229 | when n3 => |
| 228 | 230 | WE_n3_sig(conv_integer(c3)) <= '1'; |
| ... | ... | |
| 231 | 233 | peripheral_mem_addr_sig <= "001000000" + ('0' & conta(2 to 9));-- |
| 232 | 234 | es <= precuenta; |
| 233 | 235 | conta2_sig <= (others => '0'); |
| 234 | estado_evalf3_sig <= x"05"; | |
| 236 | estado_evalf3_sig <= x"0006"; | |
| 235 | 237 | |
| 236 | 238 | when n4 => |
| 237 | 239 | WE_n4_sig(conv_integer(c4)) <= '1'; |
| ... | ... | |
| 240 | 242 | peripheral_mem_addr_sig <= "001000000" + ('0' & conta(2 to 9));-- |
| 241 | 243 | es <= precuenta; |
| 242 | 244 | conta2_sig <= (others => '0'); |
| 243 | estado_evalf3_sig <= x"06"; | |
| 245 | estado_evalf3_sig <= x"0007"; | |
| 244 | 246 | |
| 245 | 247 | when precuenta => |
| 246 | 248 | WE_n2_sig <= WE_n2; |
| ... | ... | |
| 254 | 256 | conta_sig <= conta; |
| 255 | 257 | conta2_sig <= conta + 1; |
| 256 | 258 | es <= cuenta; |
| 257 | estado_evalf3_sig <= x"07"; | |
| 259 | estado_evalf3_sig <= x"0008"; | |
| 258 | 260 | |
| 259 | 261 | when cuenta => |
| 260 | 262 | DI_n2(conv_integer(c2)) <= salida_nivel(2); |
| ... | ... | |
| 292 | 294 | errores_sig <= errores_aux; |
| 293 | 295 | end if; |
| 294 | 296 | |
| 295 | estado_evalf3_sig <= x"08"; | |
| 297 | estado_evalf3_sig <= x"0009"; | |
| 296 | 298 | |
| 297 | 299 | when final => |
| 298 | 300 | if(nivel_reg = "0010")then |
| ... | ... | |
| 305 | 307 | peripheral_mem_en <= '1'; |
| 306 | 308 | peripheral_mem_addr_sig <= peripheral_mem_addr_crom; |
| 307 | 309 | es <= proceso; |
| 308 | estado_evalf3_sig <= x"09"; | |
| 310 | estado_evalf3_sig <= x"000A"; | |
| 309 | 311 | |
| 310 | 312 | when final2 => |
| 311 | 313 | if(habilita = '1') then |
| ... | ... | |
| 314 | 316 | es <= inicio; |
| 315 | 317 | end if; |
| 316 | 318 | fin_ack_sig <= '1'; |
| 317 | estado_evalf3_sig <= x"0A"; | |
| 319 | estado_evalf3_sig <= x"000B"; | |
| 318 | 320 | when others => es <= inicio; |
| 319 | 321 | |
| 320 | 322 | end case; |
| ... | ... | |
| 346 | 348 | peripheral_mem_addr_crom <= "000000000"; |
| 347 | 349 | errores_aux <= (others => '0'); |
| 348 | 350 | nivel_reg <= "0000"; |
| 349 | estado_evalf3 <= x"00"; | |
| 351 | estado_evalf3 <= x"0000"; | |
| 350 | 352 | elsif(rising_edge(clk))then |
| 351 | 353 | ep <= es; |
| 352 | 354 | c1 <= c1_sig; |
| Examples/ehw4/logic/reg_bank.v | ||
|---|---|---|
| 29 | 29 | // Read control |
| 30 | 30 | always @(posedge clk) |
| 31 | 31 | if(reset) |
| 32 | rdBus = 8'h00; | |
| 32 | rdBus = 8'h00; | |
| 33 | 33 | else begin |
| 34 | rdBus = reg_bank[address]; | |
| 34 | rdBus = reg_bank[address]; | |
| 35 | 35 | end |
| 36 | 36 | |
| 37 | ||
| 38 | 37 | // Store Inputs |
| 39 | 38 | always @(posedge clk) |
| 40 | 39 | begin |
| ... | ... | |
| 67 | 66 | reg_bank[20] = error[7:0]; |
| 68 | 67 | reg_bank[21] = error[15:8]; |
| 69 | 68 | |
| 70 | reg_bank[22] = { 4'b0, status}; | |
| 69 | reg_bank[22] = {4'b0, status}; | |
| 71 | 70 | |
| 72 | 71 | // reg_bank[23] = regMT[7:0]; |
| 73 | 72 | // reg_bank[24] = regMT[15:8]; |
| ... | ... | |
| 76 | 75 | end |
| 77 | 76 | end |
| 78 | 77 | |
| 79 | ||
| 80 | 78 | assign max_com[7:0] = reg_bank[26]; |
| 81 | 79 | assign max_com[15:8] = reg_bank[27]; |
| 82 | 80 | assign max_lev = reg_bank[28]; |
Branches:
master
