Advertisement
Guest User

Untitled

a guest
Feb 12th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. //`define USE_BRAM
  2. `ifdef USE_BRAM
  3. // put code in a pre-loaded block ram
  4. reg [7:0] rom_mem[511:0];
  5. reg [7:0] rom_do;
  6. initial
  7. $readmemh("../src/rom_512.hex",rom_mem);
  8. always @(posedge clk)
  9. rom_do <= rom_mem[CPU_AB[8:0]];
  10. `else
  11. // simulate a BRAM with luts
  12. reg [7:0] rom_do;
  13. always @(posedge clk)
  14. case(CPU_AB[8:0])
  15. 9'h000: rom_do <= 8'ha2;
  16. 9'h001: rom_do <= 8'h00;
  17. 9'h002: rom_do <= 8'h8e;
  18. 9'h003: rom_do <= 8'h00;
  19. 9'h004: rom_do <= 8'h10;
  20. 9'h005: rom_do <= 8'he8;
  21. 9'h006: rom_do <= 8'h4c;
  22. 9'h007: rom_do <= 8'h02;
  23. 9'h008: rom_do <= 8'hfe;
  24. 9'h1fc: rom_do <= 8'h00;
  25. 9'h1fd: rom_do <= 8'hfe;
  26. default: rom_do <= 8'hea;
  27. endcase
  28. `endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement