-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRb.v
43 lines (39 loc) · 976 Bytes
/
Rb.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:28:52 05/30/2018
// Design Name:
// Module Name: Rb
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module Rb(rdAC,wr,rst,en,clk,bus1,bus2,out
);
input wr,en,rst,rdAC;
input clk;
input [7:0] bus1;
input [7:0] bus2;
output [7:0] out;
reg [7:0] out=8'b0;
always @ (negedge clk) begin
if (rst)
out <= 8'b0;
else if (!rdAC & wr & en) //when moving B to Y or using as an operand
out <= bus2;
else if (rdAC & !wr & !en) //when storing the result of an operation
out <= bus1;
else if (rdAC & wr & en) //when moving Y to B
out <= bus1;
end
endmodule