Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //`define USE_BRAM
- `ifdef USE_BRAM
- // put code in a pre-loaded block ram
- reg [7:0] rom_mem[511:0];
- reg [7:0] rom_do;
- initial
- $readmemh("../src/rom_512.hex",rom_mem);
- always @(posedge clk)
- rom_do <= rom_mem[CPU_AB[8:0]];
- `else
- // simulate a BRAM with luts
- reg [7:0] rom_do;
- always @(posedge clk)
- case(CPU_AB[8:0])
- 9'h000: rom_do <= 8'ha2;
- 9'h001: rom_do <= 8'h00;
- 9'h002: rom_do <= 8'h8e;
- 9'h003: rom_do <= 8'h00;
- 9'h004: rom_do <= 8'h10;
- 9'h005: rom_do <= 8'he8;
- 9'h006: rom_do <= 8'h4c;
- 9'h007: rom_do <= 8'h02;
- 9'h008: rom_do <= 8'hfe;
- 9'h1fc: rom_do <= 8'h00;
- 9'h1fd: rom_do <= 8'hfe;
- default: rom_do <= 8'hea;
- endcase
- `endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement