[HDL] Add SPRAM module to generic yosys tech lib for openfpga usage
This commit is contained in:
parent
73b06256d0
commit
cea43c2c45
|
@ -0,0 +1,15 @@
|
||||||
|
//---------------------------------------
|
||||||
|
// 1-bit adder
|
||||||
|
//---------------------------------------
|
||||||
|
module adder(
|
||||||
|
input cin,
|
||||||
|
input a,
|
||||||
|
input b,
|
||||||
|
output cout,
|
||||||
|
output sumout );
|
||||||
|
|
||||||
|
|
||||||
|
assign sumout = a ^ b ^ cin;
|
||||||
|
assign cout = (a & b) | ((a | b) & cin);
|
||||||
|
|
||||||
|
endmodule
|
|
@ -48,15 +48,30 @@ module dual_port_sram (
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
module adder(
|
//---------------------------------------
|
||||||
input cin,
|
// A single-port 32x8bit RAM
|
||||||
input a,
|
// This module is tuned for VTR's benchmarks
|
||||||
input b,
|
//---------------------------------------
|
||||||
output cout,
|
module single_port_ram (
|
||||||
output sumout );
|
input clk,
|
||||||
|
input we,
|
||||||
|
input [4:0] addr,
|
||||||
|
input [7:0] data,
|
||||||
|
output [7:0] out );
|
||||||
|
|
||||||
|
reg [7:0] ram[31:0];
|
||||||
|
reg [7:0] internal;
|
||||||
|
|
||||||
assign sumout = a ^ b ^ cin;
|
assign out = internal;
|
||||||
assign cout = (a & b) | ((a | b) & cin);
|
|
||||||
|
always @(posedge clk) begin
|
||||||
|
if(wen) begin
|
||||||
|
ram[addr] <= data;
|
||||||
|
end
|
||||||
|
|
||||||
|
if(ren) begin
|
||||||
|
internal <= ram[addr];
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
Loading…
Reference in New Issue