Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module registers(
- clk,
- oe,
- we,
- addr,
- in,
- out,
- disp_addr,
- disp_out
- );
- parameter width = 16;
- parameter depth = 8;
- parameter addr_width = 3;
- input clk;
- input oe;
- input we;
- input [addr_width-1 : 0] addr;
- input [width-1 : 0] in;
- output[width-1 : 0] out;
- input [addr_width-1 : 0] disp_addr;
- output[width-1 : 0] disp_out;
- reg [width-1 : 0] regs[depth-1 : 0];
- reg [addr_width : 0] i;
- initial begin
- for(i = 0; i < depth; i = i + 1)
- regs[i] <= 0;
- end
- always @(posedge clk) begin
- if(we)
- regs[addr] <= in;
- end
- assign out = oe ? regs[addr] : 0;
- assign disp_out = regs[disp_addr];
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement