zynq-sandbox

old FPGA projects for ZYNQ
git clone http://frotz.net/git/zynq-sandbox.git
Log | Files | Refs | README

axi_write_to_sram.sv (1075B)


      1 // Copyright 2014 Brian Swetland <swetland@frotz.net>
      2 //
      3 // Licensed under the Apache License, Version 2.0 (the "License");
      4 // you may not use this file except in compliance with the License.
      5 // You may obtain a copy of the License at
      6 //
      7 //     http://www.apache.org/licenses/LICENSE-2.0
      8 //
      9 // Unless required by applicable law or agreed to in writing, software
     10 // distributed under the License is distributed on an "AS IS" BASIS,
     11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 // See the License for the specific language governing permissions and
     13 // limitations under the License.
     14 
     15 `timescale 1ns / 1ps
     16 
     17 `ifdef verilator
     18 module testbench(inout clk);
     19 `else
     20 module testbench();
     21 reg clk = 0;
     22 always #5 clk = ~clk;
     23 `endif
     24 
     25 reg go = 0;
     26 
     27 axi_ifc axi0();
     28 
     29 axi_pattern_writer writer0(
     30 	.clk(clk),
     31 	.trigger(go),
     32 	.m(axi0)
     33 	);
     34 
     35 axi_sram sram0(
     36 	.clk(clk),
     37 	.s(axi0)
     38 	);
     39 
     40 integer count = 0;
     41 
     42 always_ff @(posedge clk) begin
     43 	count <= count + 1;
     44 	case (count)
     45 	5: go <= 1;
     46 	6: go <= 0;
     47 	30: go <= 1;
     48 	31: go <= 0;
     49 	100: $finish();
     50 	endcase
     51 end
     52 
     53 endmodule
     54