diff options
author | Flavian Kaufmann <flavian@flaviankaufmann.ch> | 2024-05-20 11:39:26 +0200 |
---|---|---|
committer | Flavian Kaufmann <flavian@flaviankaufmann.ch> | 2024-05-20 11:39:26 +0200 |
commit | 407a3ff54a35cbe99ba6ac743376e9b0e9718fc1 (patch) | |
tree | b96527b0b55bb63e21551f9a93d3c3271dd39988 /src/io.v | |
parent | def3f62f7f8d6b5bd4b15500c7d11935540e81da (diff) | |
download | riscv_cpu-407a3ff54a35cbe99ba6ac743376e9b0e9718fc1.tar.gz riscv_cpu-407a3ff54a35cbe99ba6ac743376e9b0e9718fc1.zip |
nextpnr himbaechel
Diffstat (limited to 'src/io.v')
-rw-r--r-- | src/io.v | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/io.v b/src/io.v new file mode 100644 index 0000000..f062f31 --- /dev/null +++ b/src/io.v @@ -0,0 +1,28 @@ +module io ( + input clk, + input rstn, + + input we, + input [31:0] addr, + input [31:0] wd, + + output reg [31:0] rd, + + input [31:0] io_in, + output reg [31:0] io_out +); + +`include "include/consts.vh" + +always @ (posedge clk) begin + if (!rstn) begin + io_out <= 32'b0; + end else if (we && addr == 32'h0000_0004) begin + io_out <= wd; + end + if (addr == 32'h0000_0000) rd <= io_in; + else if (addr == 32'h0000_0004) rd <= io_out; + else rd <= 32'b0; +end + +endmodule
\ No newline at end of file |