Skip to content

Instantly share code, notes, and snippets.

@Laksen
Laksen / packed_netlist.xsd
Created July 15, 2018 12:04
VPR XML Schemas
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="named_value">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="port">
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="is_clock" type="xs:boolean" />
<xs:attribute name="clock" type="xs:string" />
<xs:attribute name="combinational_sink_ports" type="xs:string" />
</xs:complexType>
void bm64_baseisa(const uint64_t in[64], uint64_t out[64])
{
for (int i2 = 0; i2 < 64; i2 += 8) // in[] rows, word index
for (int j = 0; j < 8; j++) // in[] columns, bit index
{
int j_shift = j*8;
uint64_t res = 0;
for (int i=0; i<8; i++)
res |= ((in[i2+i] >> j_shift) & 0xFF) << (i*8);
@Laksen
Laksen / pwm_gen.v
Created April 1, 2020 17:26
Microstepper prototype
module pwm_gen #( parameter WIDTH = 8 )
(input clk,
input rst,
input [WIDTH-1:0] value,
output out);
reg out = 0;
reg [WIDTH-1:0] curr_value = 0;