diff options
author | Nick McKinney <nick@kmonkey.net> | 2016-12-01 21:36:51 -0600 |
---|---|---|
committer | Nick McKinney <nick@kmonkey.net> | 2016-12-01 21:36:51 -0600 |
commit | 37db52dbd66db1fd43337082249c469eda39f776 (patch) | |
tree | eff432c8922c877f60aba36e216710e41d8304dd /regFile.v |
initial commit
Diffstat (limited to 'regFile.v')
-rw-r--r-- | regFile.v | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/regFile.v b/regFile.v new file mode 100644 index 0000000..4331adc --- /dev/null +++ b/regFile.v @@ -0,0 +1,27 @@ +module regFile ( + input clk, + input [2:0] regA, + input [2:0] regB, + input [2:0] regDest, + input [15:0] dataIn, + input we, + input hb, + input lb, + output [15:0] dataA, + output [15:0] dataB +); + + reg [15:0] register[7]; + + assign dataA = register[regA]; + assign dataB = register[regB]; + + always @(posedge clk) begin + if(we) begin + register[regDest] <= { + hb ? dataIn[15:8] : register[regDest][15:8], + lb ? dataIn[7:0] : register[regDest][7:0] + }; + end + end +endmodule |