[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
|
||||
|
||||
module adder(
|
||||
input cin,
|
||||
input a,
|
||||
input b,
|
||||
output cout,
|
||||
output sumout );
|
||||
//---------------------------------------
|
||||
// A single-port 32x8bit RAM
|
||||
// This module is tuned for VTR's benchmarks
|
||||
//---------------------------------------
|
||||
module single_port_ram (
|
||||
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 cout = (a & b) | ((a | b) & cin);
|
||||
assign out = internal;
|
||||
|
||||
always @(posedge clk) begin
|
||||
if(wen) begin
|
||||
ram[addr] <= data;
|
||||
end
|
||||
|
||||
if(ren) begin
|
||||
internal <= ram[addr];
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
Loading…
Reference in New Issue